CLI
Amber has a built in CLI tool, to make your life easier while developing applications.
Here is a list of the available commands:
    db, database - Performs database maintenance tasks
    e, encrypt - Encrypts environment YAML file. [env | -e --editor | --noedit]
    x, exec - Executes Crystal code within the application scope
    g, generate - Generate Amber classes
    n, new - Generates a new Amber project
    routes - Prints all defined application routes
    w, watch - Starts amber development server and rebuilds on file changes
Read a long this guide to learn more about these command and how much time and efficient it can make your development experience.

Getting Command Help

You can get help from each command by running -h or --help next to the command
Eg.
1
$ amber --help
Copied!
This will output to your shell the following documentation.
1
amber [OPTIONS] SUBCOMMAND
2
3
Amber - Command Line Interface
4
5
The `amber new` command creates a new Amber application with a default
6
directory structure and configuration at the path you specify.
7
8
You can specify extra command-line arguments to be used every time
9
`amber new` runs in the .amber.yml configuration file in your project
10
root directory
11
12
Note that the arguments specified in the .amber.yml file does not affect the
13
defaults values shown above in this help message.
14
15
Usage:
16
amber new [app_name] -d [pg | mysql | sqlite] -t [slang | ecr] -m [granite, crecto] --deps
17
18
Subcommands:
19
db, database # Performs database maintenance tasks
20
e, encrypt # Encrypts environment YAML file. [env | -e --editor | --noedit]
21
x, exec # Executes Crystal code within the application scope
22
g, generate # Generate Amber classes
23
n, new # Generates a new Amber project
24
routes # Prints all defined application routes
25
w, watch # Starts amber development server and rebuilds on file changes
26
27
Options:
28
-d, --database # Preconfigure for selected database. Options: pg | mysql | sqlite (default: pg)
29
-m, --model # Preconfigure for selected model. Options: granite (default: granite)
30
-t, --template # Preconfigure for selected template engine. Options: slang | ecr (default: slang)
31
-h, --help # Describe available commands and usages
32
-v, --version # Prints Amber version
33
34
Example:
35
amber new ~/Code/Projects/weblog
36
This generates a skeletal Amber installation in ~/Code/Projects/weblog.
Copied!

Usage

1
amber new [your_app] -d [pg | mysql | sqlite] -t [slang | ecr] --deps
2
cd [your_app]
Copied!

Options

    -d defaults to pg
    -t defaults to slang
    --deps will run crystal deps for you.
Last modified 2yr ago