Jay Overview
Basic Usage
The command-line tool, Jay, has been mentioned throughout this documentation quite a few times now so it’s a good time to talk a little about the tool.
Jay uses the brilliant github.com/alecthomas/kingpin package to manage the help documents, commands, subcommands, and arguments. It takes care of groundwork so it can focus on the actual tasks.
If you ever want to see the help documents for a command or subcommand, add
-h or --help to the end and the help documentation should be able to assist.
If you are still having problems, check out the
Jay GoDoc.
When using Jay, there are flags, commands, and subcommands.
The available flags throughout are:
-hor--helpfor help documentation-vor--versionfor version information-cor--configto specify the env.json config file (otherwise JAYCONFIG environment variable will be used)
The available commands are:
jay envfor managing the env.json filejay findfor locating text inside files in subfoldersjay replacefor replacing text inside files in subfolderjay generatefor creating code based on templates using the text/template packagejay migrate:mysqlfor managing the MySQL database state
The available subcommands are:
jay env makefor creating env.json from env.json.examplejay env keyshowfor showing newly generated session keysjay env updateshowfor updating env.json with newly generation session keysjay migrate:mysql makefor creating a new migration ‘up’ file and ‘down’ filejay migrate:mysql allfor applying all ‘up’ migrationsjay migrate:mysql resetfor applying all ‘down’ migrationsjay migrate:mysql refreshfor applying all ‘down’ then ‘up’ migrationsjay migrate:mysql statusfor displaying the current database statejay migrate:mysql upfor applying only one ‘up’ migrationjay migrate:mysql downfor applying one one ‘down’ migration
There is also a common syntax used by each of the commands, subcommands, and arguments that make the help documents easy to follow.
- Flags have one or two dashes in the front:
-h, --help - Commands follow the application name (jay):
jay migrate:mysql - Subcommands follow the command:
jay migrate:mysql make - Arguments follow the command or subcommand:
jay migrate:mysql make <description> - Required arguments:
<required> - Optional arguments:
[<optional>]