aah CLI Tool

Here you will learn aah CLI flags, commands and it’s usage. It’s very handy for development, Continuous Integration (CI) and deployment preparation.

aah CLI is fully POSIX compliant flags (includes short and long versions) and command aliases too.

Available Commands

Command: list

Since v0.6 list command, alias l - it scans GOPATH and lists all the import paths of aah project.

‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
           aah framework v0.10 - https://aahframework.org           
____________________________________________________________________
# Report improvements/bugs at https://github.com/go-aah/aah/issues #

Scanning GOPATH: /Users/jeeva/go/...

4 aah projects were found, import paths are:
    github.com/go-aah/tutorials/domain-subdomain
    github.com/go-aah/tutorials/html-minify
    github.com/go-aah/tutorials/i18n-url-query-param
    github.com/go-aah/website

Command: new

new command, alias n - helps you to quick start new aah Web and API application. It is an interactive command. Just provide an appropriate inputs and choices.

aah new

Command: run

run command, alias r - is used to run the aah application.

Note: It is recommended to use build command to create build artifact and deploy it on server instead of using run command.

Supported options are:

-i value, --importpath value  Import path of aah application
-e value, --envprofile value  Environment profile name to activate. e.g: dev, qa, prod
-c value, --config value      External config file for overriding aah.conf values

Use aah help run to learn more.

Command: build

build command, alias b - is used to create aah application build artifact for deployment. Default location and name is <app-base-dir>/build/<app-binary-name>-<app-version>-<goos>-<goarch>.zip or you can use your custom artifact name too.

Supported options are:

-i value, --importpath value  Import path of aah application
-e value, --envprofile value  Environment profile name to activate. e.g: dev, qa, prod
-o value, --output value      Output of aah application build artifact. Default is '<app-base-dir>/build/<app-binary-name>-<app-version>-<goos>-<goarch>.zip'

Artifact naming convention:

  • <app-binary-name>-<app-version>-<goos>-<goarch>.zip
    • For e.g.: aahwebsite-381eaa8-darwin-amd64.zip

Use aah help build to learn more.

Command: clean

Since v0.7 clean command, alias c - is to clean generated files and build directory of the aah project.

Supported options are:

-i value, --importpath value  Import path of aah application

Use aah help clean to learn more.

Command: switch

Since v0.9 switch command, alias s - is to switch between aah release (currently on your GOPATH) and latest edge version.

Supported options are:

-v value, --version value  To mention latest release or edge version (default: "edge")
-w, --whoami   To know which version is currently active
-r, --refresh  To refresh edge version to the latest codebase  # since v0.10

Use aah help switch to learn more.

Note:

  • It works only on GOPATH. Gradually I may add vendorize support.
  • It always operates on latest edge version and current release version on your GOPATH, specific version is not supported.

Command: update

Since v0.10 update command, alias u - is to update your aah to the latest release version on your GOPATH.

Use aah help update to learn more.

Note:

  • It works only on GOPATH. Gradually I may add vendorize support.
  • It always operates on aah latest release version, specific version is not supported.

Command: generate

Since v0.10 generate command, alias g - is to generate boilerplate code, configurations and complement scripts, etc.

Use aah generate help to learn more about available generate sub commands.

Example of systemd service file generate

aah generate script --name systemd --importpath github.com/user/appname

# Short form
aah g s -n systemd -i github.com/user/appname

# If you're on app directory
aah g s -n systemd

Example of docker file generate

aah generate script --name docker --importpath github.com/user/appname

# Short form
aah g s -n docker -i github.com/user/appname

# If you're on app directory
aah g s -n docker

Command: help

help command alias h - helps you to learn aah command usage.

# list of available commands
aah help

# to know about one command
aah help build

Cross Compile Build

Set environment variables GOOS and GOARCH before executing aah build command. List of available GOOS and GOARCH values, click here.

Building linux binary on macOS

env GOOS=linux GOARCH=amd64 aah build --output=/Users/jeeva/build

#Output:
...
Your application artifact is here: /Users/jeeva/build/myapp-99bf7df-linux-amd64.zip

Building windows exe on macOS

env GOOS=windows GOARCH=amd64 aah build --output=/Users/jeeva/build

#Output:
...
Your application artifact is here: /Users/jeeva/build/myapp-99bf7df-windows-amd64.zip