github.com/mweagle/Sparta@v1.15.0/docs_source/content/reference/cli_options/_index.md (about)

     1  ---
     2  date: 2018-01-22 21:49:38
     3  title:
     4  pre: "<b>Command Line Options</b>"
     5  weight: 139
     6  alwaysopen: false
     7  ---
     8  
     9  Sparta applications delegate `func main()` responsibilities to one of Sparta's Main entrypoints ([Main](https://godoc.org/github.com/mweagle/Sparta#Main), [MainEx](https://godoc.org/github.com/mweagle/Sparta#MainEx)). This provides each application with some standard command line options as shown below:
    10  
    11  ```shell
    12  $ go run main.go --help
    13  Simple Sparta application that demonstrates core functionality
    14  
    15  Usage:
    16    main [command]
    17  
    18  Available Commands:
    19    delete      Delete service
    20    describe    Describe service
    21    execute     Start the application and begin handling events
    22    explore     Interactively explore a provisioned service
    23    help        Help about any command
    24    profile     Interactively examine service pprof output
    25    provision   Provision service
    26    status      Produce a report for a provisioned service
    27    version     Display version information
    28  
    29  Flags:
    30    -f, --format string    Log format [text, json] (default "text")
    31    -h, --help             help for main
    32        --ldflags string   Go linker string definition flags (https://golang.org/cmd/link/)
    33    -l, --level string     Log level [panic, fatal, error, warn, info, debug] (default "info")
    34        --nocolor          Boolean flag to suppress colorized TTY output
    35    -n, --noop             Dry-run behavior only (do not perform mutations)
    36    -t, --tags string      Optional build tags for conditional compilation
    37    -z, --timestamps       Include UTC timestamp log line prefix
    38  
    39  Use "main [command] --help" for more information about a command.
    40  ```
    41  
    42  It's also possible to add [custom flags](/reference/application/custom_flags) and/or [custom commands](/reference/application/custom_commands) to extend your application's behavior.
    43  
    44  These command line options are briefly described in the following sections. For the most up to date information, use the `--help` subcommand option.
    45  
    46  # Standard Commands
    47  
    48  ## Delete
    49  
    50  This simply deletes the stack (if present). Attempting to delete a non-empty stack is not treated as an error.
    51  
    52  ## Describe
    53  
    54  The `describe` command line option produces an HTML summary (see [graph.html](/images/overview/graph.html) for an example) of your Sparta service.
    55  
    56  The report also includes the automatically generated CloudFormation template which can be helpful when diagnosing provisioning errors.
    57  
    58  ## Execute
    59  
    60  This command is used when the cross compiled binary is provisioned in AWS lambda. It is not (typically) applicable to the local development workflow.
    61  
    62  ## Explore
    63  
    64  The `explore` option creates a terminal GUI that supports interactive exploration of lambda functions deployed to AWS. This ui recursively searches for all _\*.json_ files in the source tree to populate the set of eligible events that can be submitted.
    65  
    66  ![Explore](/images/explore.jpg "Explore")
    67  
    68  ## Profile
    69  
    70  The `profile` command line option enters an interactive session where a previously profiled application can be locally visualized using snapshots posted to S3 and provided to a local [pprof ui](https://rakyll.org/pprof-ui/).
    71  
    72  ## Provision
    73  
    74  The `provision` option is the subcommand most likely to be used during development. It provisions the Sparta application to AWS Lambda.
    75  
    76  ## Status
    77  
    78  The `status` option queries AWS for the current stack status
    79  and produces an optionally account-id redacted report. Stack
    80  outputs, tags, and other metadata are included in the status report:
    81  
    82  ```bash
    83  $ go run main.go status --redact
    84  INFO[0000] ════════════════════════════════════════════════
    85  INFO[0000] ╔═╗╔═╗╔═╗╦═╗╔╦╗╔═╗   Version : 1.5.0
    86  INFO[0000] ╚═╗╠═╝╠═╣╠╦╝ ║ ╠═╣   SHA     : 8f199e1
    87  INFO[0000] ╚═╝╩  ╩ ╩╩╚═ ╩ ╩ ╩   Go      : go1.11.1
    88  INFO[0000] ════════════════════════════════════════════════
    89  INFO[0000] Service: MyHelloWorldStack-mweagle            LinkFlags= Option=status UTC="2018-10-14T12:28:18Z"
    90  INFO[0000] ════════════════════════════════════════════════
    91  INFO[0001] StackId                                       Id="arn:aws:cloudformation:us-west-2:************:stack/MyHelloWorldStack-mweagle/5817dff0-c5f1-11e8-b43a-503ac9841a99"
    92  INFO[0001] Stack status                                  State=UPDATE_COMPLETE
    93  INFO[0001] Created                                       Time="2018-10-02 03:14:59.127 +0000 UTC"
    94  INFO[0001] Last Update                                   Time="2018-10-06 14:20:40.267 +0000 UTC"
    95  INFO[0001] Tag                                           io:gosparta:buildId=7ee3e1bc52f15c4a636e05061eaec7b748db22a9
    96  ```
    97  
    98  ## Version
    99  
   100  The `version` option is a diagnostic command that prints the version of the Sparta framework embedded in the application.
   101  
   102  ```bash
   103  $ go run main.go version
   104  INFO[0000] ════════════════════════════════════════════════
   105  INFO[0000] ╔═╗╔═╗╔═╗╦═╗╔╦╗╔═╗   Version : 1.5.0
   106  INFO[0000] ╚═╗╠═╝╠═╣╠╦╝ ║ ╠═╣   SHA     : 8f199e1
   107  INFO[0000] ╚═╝╩  ╩ ╩╩╚═ ╩ ╩ ╩   Go      : go1.11.1
   108  INFO[0000] ════════════════════════════════════════════════
   109  INFO[0000] Service: MyHelloWorldStack-mweagle            LinkFlags= Option=version UTC="2018-10-14T12:27:36Z"
   110  INFO[0000] ════════════════════════════════════════════════
   111  ```