Skip to content

Commit

Permalink
go-aah/aah#116 doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevatkm committed May 27, 2018
1 parent 1f37ba3 commit 735e4ec
Showing 1 changed file with 43 additions and 175 deletions.
218 changes: 43 additions & 175 deletions aah-cli-tool.md
@@ -1,202 +1,70 @@
Title: aah CLI Tool
Desc: aah CLI tool is development buddy for developers to take advantage aah framework capabilities.
Keywords: aah CLI tool, ClI tool, hot-reload, cross compile, commands, run, new, build, version, list, clean
Keywords: aah CLI tool, ClI tool, hot-reload, cross compile, commands, run, new, build, version, list, clean, generate, migrate, switch, update
---
# 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.
Introduction to aah CLI tool, it's very handy tool 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
* Global Flags
- `-h, --help` - show help
- `-v, --version` - print aah framework versions and go version
* [list](#command-list)
* [new](#command-new)
* [run](#command-run)
* [build](#command-build)
* [clean](#command-clean)
* [switch](#command-switch)
* [update](#command-update)
* [generate](#command-generate)
* [help](#command-help)
* [Cross Compile Build](#cross-compile-build)

## Command: list
<span class="badge lb-sm">Since v0.6</span> `list` command, alias `l` - it scans GOPATH and lists all the import paths of aah project.

```cfg
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
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.

```cfg
aah new
```


## Command: run

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

<div class="alert alert-info-blue">
<p><strong>Note:</strong> It is recommended to use <code>build</code> command to create build artifact and deploy it on server instead of using run command.</p>
</div>

Supported options are:
```cfg
-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:
```cfg
-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

<span class="badge lb-sm">Since v0.7</span> `clean` command, alias `c` - is to clean generated files and build directory of the aah project.

Supported options are:
```cfg
-i value, --importpath value Import path of aah application
```
### Table of Contents

Use `aah help clean` to learn more.


## Command: switch

<span class="badge lb-sm">Since v0.9</span> `switch` command, alias `s` - is to switch between aah `release` (currently on your GOPATH) and latest `edge` version.

Supported options are:
```cfg
-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.

<div class="alert alert-info-blue">
<p><strong>Note:</strong>
<ul>
<li>It works only on GOPATH. Gradually I may add vendorize support.</li>
<li>It always operates on latest edge version and current release version on your GOPATH, specific version is not supported.</li>
</ul>
</p>
</div>


## Command: update

<span class="badge lb-sm">Since v0.10</span> `update` command, alias `u` - is to update your aah to the latest release version on your GOPATH.
* [Commands](#commands)
* [Cross Compile Build](#cross-compile-build)

Use `aah help update` to learn more.
## Commands

<div class="alert alert-info-blue">
<p><strong>Note:</strong>
<ul>
<li>It works only on GOPATH. Gradually I may add vendorize support.</li>
<li>It always operates on aah latest release version, specific version is not supported.</li>
</ul>
</p>
<div class="alert alert-info-green">
<p><strong>Best Practice:</strong> For production use (aka <code>-profile prod</code>), it is recommended to follow build and deploy approach instead of using <code>aah run</code>.</p>
</div>


## Command: generate

<span class="badge lb-sm">Since v0.10</span> `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
```cfg
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
```cfg
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.

```cfg
# list of available commands
aah help
# to know about one command
aah help build
```conf
---------------------------------------------------------------
aah framework v0.11.0
---------------------------------------------------------------
# Report improvements/bugs at https://aahframework.org/issues #
Usage:
aah [global options] command [command options] [arguments...]
Commands:
new, n Creates new aah 'web', 'api' or 'websocket' application (interactive)
run, r Runs aah application (supports hot-reload)
build, b Builds aah application for deployment (single or non-single)
list, l Lists all the aah projects on your GOPATH
clean, c Cleans the aah generated files and build directory
switch, s Switches between aah release and edge version
update, u Updates aah to the latest release version on your GOPATH
generate, g Generates boilerplate code, configurations, complement scripts (systemd, docker), etc.
migrate, m Migrates application codebase to current version of aah (currently beta)
help, h Shows a list of commands or help for one command
Global Options:
-h, --help Shows help
-v, --version Prints cli, aah, go and aah libraries version
```

## Cross Compile Build

Set environment variables `GOOS` and `GOARCH` before executing `aah build` command. List of available GOOS and GOARCH values, [click here](https://golang.org/doc/install/source#environment).

#### Building linux binary on macOS
```cfg
env GOOS=linux GOARCH=amd64 aah build --output=/Users/jeeva/build

#Output:
```bash
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
Application artifact is here: /Users/jeeva/build/myapp-99bf7df-linux-amd64.zip
```

#### Building windows exe on macOS
```cfg
env GOOS=windows GOARCH=amd64 aah build --output=/Users/jeeva/build

#Output:
```bash
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
Application artifact is here: /Users/jeeva/build/myapp-99bf7df-windows-amd64.zip
```

0 comments on commit 735e4ec

Please sign in to comment.