(快速参考)

Grails --help 语法

用途

Grails 中的 --help 语法用于请求命令行帮助以及有关特定 Grails 命令的详细信息。

示例

下面是 Grails 中 --help 语法的部分用法示例

  1. 显示常规的 Grails 命令行帮助

    grails --help
  2. 获取特定 Grails 命令的帮助,例如 create-app

    grails create-app --help
  3. 请求有关 generate-controller 命令的帮助

    grails generate-controller --help

描述

Grails 中的 --help 语法是获取有关 Grails 命令及其用法的全面信息的有效工具。它使用户能够了解如何有效地执行特定命令,并提供有关可用选项、参数和用法示例的详细信息。

当你执行 grails --help 时,你将收到 Grails CLI 功能的摘要,包括应用程序生成命令、全局选项和可用命令的列表。此输出旨在帮助用户上手并有效浏览 Grails CLI。

用法

若要使用 --help 语法,只需将其附加到 Grails 命令即可,如上面示例中所示。这会触发显示与指定命令相关的详细帮助和信息。

grails> --help
Usage: grails [-hvVx] [COMMAND]
Grails CLI command line interface for generating projects and services.
Application generation commands are:

*  create-app NAME
*  create-webapp NAME
*  create-restapi NAME
*  create-plugin NAME
*  create-webplugin NAME

Options:
  -h, --help         Show this help message and exit.
  -v, --verbose      Create verbose output.
  -V, --version      Print version information and exit.
  -x, --stacktrace   Show full stack trace when exceptions occur.

Commands:
  create-app         Creates an application
  create-webapp      Creates an application
  create-plugin      Creates an Grails Plugin
  create-web-plugin  Creates an Grails Web Plugin
  create-restapi     Creates an REST API

通过将 --help语法与特定的命令名称结合使用,Grails 开发人员可以访问深入的文档,使其更容易使用 Grails 命令并确保在项目中正确使用它们。下面是将 --helpgrails create-app 命令结合使用的示例

grails> create-app --help
Usage: grails create-app [-hivVx] [--list-features] [-g=GORM Implementation] [--jdk=<javaVersion>]
                         [-s=Servlet Implementation] [-t=TEST] [-f=FEATURE[,FEATURE...]]... [NAME]
Creates an application
      [NAME]            The name of the application to create.
  -f, --features=FEATURE[,FEATURE...]
                        The features to use. Possible values: h2, scaffolding, gorm-hibernate5,
                          spring-boot-starter-jetty, springloaded, spring-boot-starter-tomcat,
                          micronaut-http-client, cache-ehcache, hibernate-validator, postgres,
                          mysql, cache, database-migration, grails-gsp, hamcrest, gorm-mongodb,
                          assertj, mockito, spring-boot-starter-undertow, micronaut-inject-groovy,
                          github-workflow-java-ci, jrebel, testcontainers, sqlserver,
                          grails-console, views-markup, asset-pipeline-grails, views-json,
                          gorm-neo4j, asciidoctor, embedded-mongodb, grails-web-console,
                          logbackGroovy, mongo-sync, shade, geb, properties
  -g, --gorm=GORM Implementation
                        Which GORM Implementation to configure. Possible values: hibernate,
                          mongodb, neo4j.
  -h, --help            Show this help message and exit.
  -i, --inplace         Create a service using the current directory
      --jdk, --java-version=<javaVersion>
                        The JDK version the project should target
      --list-features   Output the available features and their descriptions
  -s, --servlet=Servlet Implementation
                        Which Servlet Implementation to configure. Possible values: none, tomcat,
                          jetty, undertow.
  -t, --test=TEST       Which test framework to use. Possible values: junit, spock.
  -v, --verbose         Create verbose output.
  -V, --version         Print version information and exit.
  -x, --stacktrace      Show full stack trace when exceptions occur.