From 245021634b873d953901e49ee271572fb8b829ca Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 26 Aug 2020 09:30:27 -0600 Subject: [PATCH 01/17] Add empty help command --- bin/maestro.js | 3 +++ src/commands/help.js | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 src/commands/help.js diff --git a/bin/maestro.js b/bin/maestro.js index 417fd4e..8d58fcb 100755 --- a/bin/maestro.js +++ b/bin/maestro.js @@ -38,6 +38,9 @@ switch (argv._[0]) { case "get-templates": require("../src/commands/getTemplates")(); break; + case "help": + require("../src/commands/help")(argv); + break; default: console.log(defaultMsg); } diff --git a/src/commands/help.js b/src/commands/help.js new file mode 100644 index 0000000..cb016b0 --- /dev/null +++ b/src/commands/help.js @@ -0,0 +1,3 @@ +const help = () => {}; + +module.exports = help; From 388446832d45fefaec76baceb087c78c9a38475d Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 26 Aug 2020 09:39:15 -0600 Subject: [PATCH 02/17] Add placeholder help messages --- src/commands/help.js | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/commands/help.js b/src/commands/help.js index cb016b0..e8662cb 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -1,3 +1,39 @@ -const help = () => {}; +const genericHelpMsg = "\"Generic help\" help message"; +const configMsg = "\"Config\" help message"; +const deployMsg = "\"Deploy\" help message"; +const teardownMsg = "\"Teardown\" help message"; +const newMsg = "\"New\" help message"; +const getTemplatesMsg = "\"Get templates\" help message"; +const helpMsg = "\"Help\" help message"; +const defaultMsg = "\"Default\" help message"; + +const help = (argv) => { + switch (argv._[1]) { + case undefined: + console.log(genericHelpMsg); + break; + case "config": + console.log(configMsg); + break; + case "deploy": + console.log(deployMsg); + break; + case "teardown": + console.log(teardownMsg); + break; + case "new": + console.log(newMsg); + break; + case "get-templates": + console.log(getTemplatesMsg); + break; + case "help": + console.log(helpMsg); + break; + default: + console.log(defaultMsg); + break; + } +}; module.exports = help; From 6f56c9de0ed4b6d0eb4c28e4a92082a42d3f6090 Mon Sep 17 00:00:00 2001 From: John Isom Date: Fri, 28 Aug 2020 17:09:07 -0600 Subject: [PATCH 03/17] fill out default help message --- src/commands/help.js | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/commands/help.js b/src/commands/help.js index e8662cb..11dbeef 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -1,11 +1,26 @@ -const genericHelpMsg = "\"Generic help\" help message"; -const configMsg = "\"Config\" help message"; -const deployMsg = "\"Deploy\" help message"; -const teardownMsg = "\"Teardown\" help message"; -const newMsg = "\"New\" help message"; -const getTemplatesMsg = "\"Get templates\" help message"; -const helpMsg = "\"Help\" help message"; -const defaultMsg = "\"Default\" help message"; +const codes = { + reset: "\033[m", + bold: "\033[1m", + faint: "\033[2m", + italic: "\033[3m", + underline: "\033[4m", + red: "\033[31m", + green: "\033[32m", + yellow: "\033[33m", + blue: "\033[34m", + magenta: "\033[35m", + cyan: "\033[36m", + white: "\033[37m", +}; + +const genericHelpMsg = `Run \`${codes.blue}maestro help${codes.reset} ${codes.italic + codes.underline + codes.red}command${codes.reset}\` to get help specific to a subcommand.`; +const configMsg = `"Config" help message`; +const deployMsg = `"Deploy" help message`; +const teardownMsg = `"Teardown" help message`; +const newMsg = `"New" help message`; +const getTemplatesMsg = `"Get templates" help message`; +const helpMsg = genericHelpMsg; +const defaultMsg = genericHelpMsg; const help = (argv) => { switch (argv._[1]) { From e4c0e5c19dbbc8453624dd3206a04eb01d065e57 Mon Sep 17 00:00:00 2001 From: John Isom Date: Fri, 28 Aug 2020 17:25:21 -0600 Subject: [PATCH 04/17] Fill out config help message --- src/commands/help.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/commands/help.js b/src/commands/help.js index 11dbeef..ece75b5 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -4,6 +4,7 @@ const codes = { faint: "\033[2m", italic: "\033[3m", underline: "\033[4m", + black: "\033[30m", red: "\033[31m", green: "\033[32m", yellow: "\033[33m", @@ -14,7 +15,11 @@ const codes = { }; const genericHelpMsg = `Run \`${codes.blue}maestro help${codes.reset} ${codes.italic + codes.underline + codes.red}command${codes.reset}\` to get help specific to a subcommand.`; -const configMsg = `"Config" help message`; +const configMsg = `maestro-config: ${codes.blue + codes.italic}maestro config${codes.reset} + Set up or alter your Maestro configuration files. + + Run ${codes.blue + codes.italic}maestro config${codes.reset} to set the global config values of AWS account number and region. + See manual page ${codes.yellow + codes.bold}maestro-config(1)${codes.reset} for more information.`; const deployMsg = `"Deploy" help message`; const teardownMsg = `"Teardown" help message`; const newMsg = `"New" help message`; From af178925518ac7725ecf65a1a5426ab5c47ff7f9 Mon Sep 17 00:00:00 2001 From: John Isom Date: Fri, 28 Aug 2020 17:46:33 -0600 Subject: [PATCH 05/17] Fill out deploy help message --- src/commands/help.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/commands/help.js b/src/commands/help.js index ece75b5..bb91407 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -18,9 +18,18 @@ const genericHelpMsg = `Run \`${codes.blue}maestro help${codes.reset} ${codes.i const configMsg = `maestro-config: ${codes.blue + codes.italic}maestro config${codes.reset} Set up or alter your Maestro configuration files. - Run ${codes.blue + codes.italic}maestro config${codes.reset} to set the global config values of AWS account number and region. + Run ${codes.blue + codes.italic}maestro config${codes.reset} to set the global config values of AWS account number and + region. + + See manual page ${codes.yellow + codes.bold}maestro-config(1)${codes.reset} for more information.`; +const deployMsg = `maestro-deploy: ${codes.blue + codes.italic}maestro deploy${codes.reset} + Deploy a full AWS Step Functions workflow with AWS Lambdas. + + Run ${codes.blue + codes.italic}maestro deploy${codes.reset} inside a Maestro project to deploy all the project's + resources including AWS IAM Roles, AWS Lambdas, and the AWS Step Functions + state machine. + See manual page ${codes.yellow + codes.bold}maestro-config(1)${codes.reset} for more information.`; -const deployMsg = `"Deploy" help message`; const teardownMsg = `"Teardown" help message`; const newMsg = `"New" help message`; const getTemplatesMsg = `"Get templates" help message`; From b077609cb18aa11b0e0ad50a1817f6312a13692a Mon Sep 17 00:00:00 2001 From: John Isom Date: Fri, 28 Aug 2020 17:50:59 -0600 Subject: [PATCH 06/17] Fill out teardown help message --- src/commands/help.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/commands/help.js b/src/commands/help.js index bb91407..3b7a413 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -25,12 +25,19 @@ const configMsg = `maestro-config: ${codes.blue + codes.italic}maestro con const deployMsg = `maestro-deploy: ${codes.blue + codes.italic}maestro deploy${codes.reset} Deploy a full AWS Step Functions workflow with AWS Lambdas. - Run ${codes.blue + codes.italic}maestro deploy${codes.reset} inside a Maestro project to deploy all the project's - resources including AWS IAM Roles, AWS Lambdas, and the AWS Step Functions - state machine. + Run ${codes.blue + codes.italic}maestro deploy${codes.reset} inside a Maestro project to quickly deploy all the + project's resources including AWS IAM Roles, AWS Lambdas, and the AWS Step + Functions state machine. - See manual page ${codes.yellow + codes.bold}maestro-config(1)${codes.reset} for more information.`; -const teardownMsg = `"Teardown" help message`; + See manual page ${codes.yellow + codes.bold}maestro-deploy(1)${codes.reset} for more information.`; +const teardownMsg = `maestro-teardown: ${codes.blue + codes.italic}maestro teardown${codes.reset} + Teardown an existing maestro project. + + Run ${codes.blue + codes.italic}maestro teardown${codes.reset} inside a Maestro project to quickly tear down all + the project's resources including AWS Lambdas, the AWS Step Functions state + machine, and optionally AWS IAM Roles. + + See manual page ${codes.yellow + codes.bold}maestro-teardown(1)${codes.reset} for more information.`; const newMsg = `"New" help message`; const getTemplatesMsg = `"Get templates" help message`; const helpMsg = genericHelpMsg; From 82e89c6019ad30f0fee0f814bf9eeba87e8bfbe2 Mon Sep 17 00:00:00 2001 From: John Isom Date: Fri, 28 Aug 2020 18:38:17 -0600 Subject: [PATCH 07/17] Fill out new help message --- src/commands/help.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/commands/help.js b/src/commands/help.js index 3b7a413..e253c67 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -31,14 +31,22 @@ const deployMsg = `maestro-deploy: ${codes.blue + codes.italic}maestro dep See manual page ${codes.yellow + codes.bold}maestro-deploy(1)${codes.reset} for more information.`; const teardownMsg = `maestro-teardown: ${codes.blue + codes.italic}maestro teardown${codes.reset} - Teardown an existing maestro project. + Teardown an existing Maestro project. Run ${codes.blue + codes.italic}maestro teardown${codes.reset} inside a Maestro project to quickly tear down all the project's resources including AWS Lambdas, the AWS Step Functions state machine, and optionally AWS IAM Roles. See manual page ${codes.yellow + codes.bold}maestro-teardown(1)${codes.reset} for more information.`; -const newMsg = `"New" help message`; +const newMsg = `maestro-new: ${codes.blue + codes.italic}maestro new${codes.reset} ${codes.italic + codes.underline + codes.red}project_name${codes.reset} + Create a new Maestro project. + + Run ${codes.blue + codes.italic}maestro new${codes.reset} ${codes.italic + codes.underline + codes.red}project_name${codes.reset} to create a new maestro project with the + given project name. + When this command is executed a prompt is displayed listing all of the + available templates on which to base this new project. + + See manual page ${codes.yellow + codes.bold}maestro-new(1)${codes.reset} for more information.`; const getTemplatesMsg = `"Get templates" help message`; const helpMsg = genericHelpMsg; const defaultMsg = genericHelpMsg; From 332d4bbb5011765f68bbeca984f25b4d531d3bc7 Mon Sep 17 00:00:00 2001 From: John Isom Date: Fri, 28 Aug 2020 18:45:17 -0600 Subject: [PATCH 08/17] Format src/commands/help.js --- src/commands/help.js | 87 ++++++++++++++++++++++++++++++-------------- 1 file changed, 60 insertions(+), 27 deletions(-) diff --git a/src/commands/help.js b/src/commands/help.js index e253c67..6a661c7 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -1,55 +1,88 @@ const codes = { - reset: "\033[m", - bold: "\033[1m", - faint: "\033[2m", - italic: "\033[3m", + reset: "\033[m", + bold: "\033[1m", + faint: "\033[2m", + italic: "\033[3m", underline: "\033[4m", - black: "\033[30m", - red: "\033[31m", - green: "\033[32m", - yellow: "\033[33m", - blue: "\033[34m", - magenta: "\033[35m", - cyan: "\033[36m", - white: "\033[37m", + black: "\033[30m", + red: "\033[31m", + green: "\033[32m", + yellow: "\033[33m", + blue: "\033[34m", + magenta: "\033[35m", + cyan: "\033[36m", + white: "\033[37m", }; -const genericHelpMsg = `Run \`${codes.blue}maestro help${codes.reset} ${codes.italic + codes.underline + codes.red}command${codes.reset}\` to get help specific to a subcommand.`; -const configMsg = `maestro-config: ${codes.blue + codes.italic}maestro config${codes.reset} +const genericHelpMsg = `Run \`${codes.blue}maestro help${codes.reset} ${ + codes.italic + codes.underline + codes.red +}command${codes.reset}\` to get help specific to a subcommand.`; + +const configMsg = `maestro-config: ${codes.blue + codes.italic}maestro config${ + codes.reset +} Set up or alter your Maestro configuration files. - Run ${codes.blue + codes.italic}maestro config${codes.reset} to set the global config values of AWS account number and + Run ${codes.blue + codes.italic}maestro config${ + codes.reset +} to set the global config values of AWS account number and region. - See manual page ${codes.yellow + codes.bold}maestro-config(1)${codes.reset} for more information.`; -const deployMsg = `maestro-deploy: ${codes.blue + codes.italic}maestro deploy${codes.reset} + See manual page ${codes.yellow + codes.bold}maestro-config(1)${ + codes.reset +} for more information.`; + +const deployMsg = `maestro-deploy: ${codes.blue + codes.italic}maestro deploy${ + codes.reset +} Deploy a full AWS Step Functions workflow with AWS Lambdas. - Run ${codes.blue + codes.italic}maestro deploy${codes.reset} inside a Maestro project to quickly deploy all the + Run ${codes.blue + codes.italic}maestro deploy${ + codes.reset +} inside a Maestro project to quickly deploy all the project's resources including AWS IAM Roles, AWS Lambdas, and the AWS Step Functions state machine. - See manual page ${codes.yellow + codes.bold}maestro-deploy(1)${codes.reset} for more information.`; -const teardownMsg = `maestro-teardown: ${codes.blue + codes.italic}maestro teardown${codes.reset} + See manual page ${codes.yellow + codes.bold}maestro-deploy(1)${ + codes.reset +} for more information.`; + +const teardownMsg = `maestro-teardown: ${ + codes.blue + codes.italic +}maestro teardown${codes.reset} Teardown an existing Maestro project. - Run ${codes.blue + codes.italic}maestro teardown${codes.reset} inside a Maestro project to quickly tear down all + Run ${codes.blue + codes.italic}maestro teardown${ + codes.reset +} inside a Maestro project to quickly tear down all the project's resources including AWS Lambdas, the AWS Step Functions state machine, and optionally AWS IAM Roles. - See manual page ${codes.yellow + codes.bold}maestro-teardown(1)${codes.reset} for more information.`; -const newMsg = `maestro-new: ${codes.blue + codes.italic}maestro new${codes.reset} ${codes.italic + codes.underline + codes.red}project_name${codes.reset} + See manual page ${codes.yellow + codes.bold}maestro-teardown(1)${ + codes.reset +} for more information.`; + +const newMsg = `maestro-new: ${codes.blue + codes.italic}maestro new${ + codes.reset +} ${codes.italic + codes.underline + codes.red}project_name${codes.reset} Create a new Maestro project. - Run ${codes.blue + codes.italic}maestro new${codes.reset} ${codes.italic + codes.underline + codes.red}project_name${codes.reset} to create a new maestro project with the + Run ${codes.blue + codes.italic}maestro new${codes.reset} ${ + codes.italic + codes.underline + codes.red +}project_name${codes.reset} to create a new maestro project with the given project name. When this command is executed a prompt is displayed listing all of the available templates on which to base this new project. - See manual page ${codes.yellow + codes.bold}maestro-new(1)${codes.reset} for more information.`; + See manual page ${codes.yellow + codes.bold}maestro-new(1)${ + codes.reset +} for more information.`; + const getTemplatesMsg = `"Get templates" help message`; -const helpMsg = genericHelpMsg; -const defaultMsg = genericHelpMsg; + +const helpMsg = genericHelpMsg; + +const defaultMsg = genericHelpMsg; const help = (argv) => { switch (argv._[1]) { From 9c21d5d7d1f64fc2a19db657646305b9becba361 Mon Sep 17 00:00:00 2001 From: John Isom Date: Fri, 28 Aug 2020 19:03:01 -0600 Subject: [PATCH 09/17] Fill out get-templates help message --- src/commands/help.js | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/commands/help.js b/src/commands/help.js index 6a661c7..e8b4382 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -14,16 +14,16 @@ const codes = { white: "\033[37m", }; -const genericHelpMsg = `Run \`${codes.blue}maestro help${codes.reset} ${ - codes.italic + codes.underline + codes.red +const genericHelpMsg = `Run \`${codes.italic + codes.blue}maestro help${codes.reset} ${ + codes.italic + codes.bold + codes.red }command${codes.reset}\` to get help specific to a subcommand.`; -const configMsg = `maestro-config: ${codes.blue + codes.italic}maestro config${ +const configMsg = `maestro-config: ${codes.italic + codes.blue}maestro config${ codes.reset } Set up or alter your Maestro configuration files. - Run ${codes.blue + codes.italic}maestro config${ + Run ${codes.italic + codes.blue}maestro config${ codes.reset } to set the global config values of AWS account number and region. @@ -32,12 +32,12 @@ const configMsg = `maestro-config: ${codes.blue + codes.italic}maestro config${ codes.reset } for more information.`; -const deployMsg = `maestro-deploy: ${codes.blue + codes.italic}maestro deploy${ +const deployMsg = `maestro-deploy: ${codes.italic + codes.blue}maestro deploy${ codes.reset } Deploy a full AWS Step Functions workflow with AWS Lambdas. - Run ${codes.blue + codes.italic}maestro deploy${ + Run ${codes.italic + codes.blue}maestro deploy${ codes.reset } inside a Maestro project to quickly deploy all the project's resources including AWS IAM Roles, AWS Lambdas, and the AWS Step @@ -48,11 +48,11 @@ const deployMsg = `maestro-deploy: ${codes.blue + codes.italic}maestro deploy${ } for more information.`; const teardownMsg = `maestro-teardown: ${ - codes.blue + codes.italic + codes.italic + codes.blue }maestro teardown${codes.reset} Teardown an existing Maestro project. - Run ${codes.blue + codes.italic}maestro teardown${ + Run ${codes.italic + codes.blue}maestro teardown${ codes.reset } inside a Maestro project to quickly tear down all the project's resources including AWS Lambdas, the AWS Step Functions state @@ -62,13 +62,13 @@ const teardownMsg = `maestro-teardown: ${ codes.reset } for more information.`; -const newMsg = `maestro-new: ${codes.blue + codes.italic}maestro new${ +const newMsg = `maestro-new: ${codes.italic + codes.blue}maestro new${ codes.reset -} ${codes.italic + codes.underline + codes.red}project_name${codes.reset} +} ${codes.italic + codes.bold + codes.red}project_name${codes.reset} Create a new Maestro project. - Run ${codes.blue + codes.italic}maestro new${codes.reset} ${ - codes.italic + codes.underline + codes.red + Run ${codes.italic + codes.blue}maestro new${codes.reset} ${ + codes.italic + codes.bold + codes.red }project_name${codes.reset} to create a new maestro project with the given project name. When this command is executed a prompt is displayed listing all of the @@ -78,7 +78,18 @@ const newMsg = `maestro-new: ${codes.blue + codes.italic}maestro new${ codes.reset } for more information.`; -const getTemplatesMsg = `"Get templates" help message`; +const getTemplatesMsg = `maestro-get-templates: ${ + codes.italic + codes.blue +}maestro get-templates${codes.reset} + Fetch and install the default Maestro templates. + + Run ${codes.italic + codes.blue}maestro get-templates${codes.reset} to fetch and install the default Maestro + templates from the ${codes.yellow}⟨${codes.green + codes.underline}https://github.com/maestro-framework/maestro-templates${codes.reset + codes.yellow}⟩${codes.reset} + git repository. + + See manual page ${codes.yellow + codes.bold}maestro-get-templates(1)${ + codes.reset +} for more information.`; const helpMsg = genericHelpMsg; From 24d3609edfd51465d8247fe88ba350ee7e19dfb3 Mon Sep 17 00:00:00 2001 From: John Isom Date: Fri, 28 Aug 2020 19:10:39 -0600 Subject: [PATCH 10/17] Fill out help help message --- src/commands/help.js | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/commands/help.js b/src/commands/help.js index e8b4382..4d085a3 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -14,10 +14,6 @@ const codes = { white: "\033[37m", }; -const genericHelpMsg = `Run \`${codes.italic + codes.blue}maestro help${codes.reset} ${ - codes.italic + codes.bold + codes.red -}command${codes.reset}\` to get help specific to a subcommand.`; - const configMsg = `maestro-config: ${codes.italic + codes.blue}maestro config${ codes.reset } @@ -67,8 +63,8 @@ const newMsg = `maestro-new: ${codes.italic + codes.blue}maestro new${ } ${codes.italic + codes.bold + codes.red}project_name${codes.reset} Create a new Maestro project. - Run ${codes.italic + codes.blue}maestro new${codes.reset} ${ - codes.italic + codes.bold + codes.red + Run ${codes.italic + codes.blue}maestro new${ + codes.bold + codes.red }project_name${codes.reset} to create a new maestro project with the given project name. When this command is executed a prompt is displayed listing all of the @@ -83,22 +79,41 @@ const getTemplatesMsg = `maestro-get-templates: ${ }maestro get-templates${codes.reset} Fetch and install the default Maestro templates. - Run ${codes.italic + codes.blue}maestro get-templates${codes.reset} to fetch and install the default Maestro - templates from the ${codes.yellow}⟨${codes.green + codes.underline}https://github.com/maestro-framework/maestro-templates${codes.reset + codes.yellow}⟩${codes.reset} + Run ${codes.italic + codes.blue}maestro get-templates${ + codes.reset +} to fetch and install the default Maestro + templates from the ${codes.yellow}⟨${ + codes.green + codes.underline +}https://github.com/maestro-framework/maestro-templates${ + codes.reset + codes.yellow +}⟩${codes.reset} git repository. See manual page ${codes.yellow + codes.bold}maestro-get-templates(1)${ codes.reset } for more information.`; -const helpMsg = genericHelpMsg; +const helpMsg = `maestro-help: ${codes.italic + codes.blue}maestro help ${ + codes.bold + codes.red +}command${codes.reset} + Display help about a specific Maestro command. -const defaultMsg = genericHelpMsg; + Run ${codes.italic + codes.blue}maestro help ${ + codes.bold + codes.red +}command${codes.reset} to get help specific to a Maestro subcommand. + + See manual page ${codes.yellow + codes.bold}maestro-help(1)${ + codes.reset +} for more information.`; + +const defaultMsg = `Run \`${codes.italic + codes.blue}maestro help${ + codes.bold + codes.red +}command${codes.reset}\` to get help specific to a subcommand.`; const help = (argv) => { switch (argv._[1]) { case undefined: - console.log(genericHelpMsg); + console.log(defaultMsg); break; case "config": console.log(configMsg); From 0b518e7d5ee35f875d502dd1e574d66b612b1434 Mon Sep 17 00:00:00 2001 From: John Isom Date: Fri, 28 Aug 2020 20:20:33 -0600 Subject: [PATCH 11/17] Fix typos --- src/commands/help.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/commands/help.js b/src/commands/help.js index 4d085a3..fd8d8ed 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -1,3 +1,10 @@ +/* +TODO: +- add support for a `--help/-h` flag to any subcommand +- create man page for maestro-help(1) +- add flag usage for commands that need it +*/ + const codes = { reset: "\033[m", bold: "\033[1m", @@ -58,12 +65,12 @@ const teardownMsg = `maestro-teardown: ${ codes.reset } for more information.`; -const newMsg = `maestro-new: ${codes.italic + codes.blue}maestro new${ - codes.reset -} ${codes.italic + codes.bold + codes.red}project_name${codes.reset} +const newMsg = `maestro-new: ${codes.italic + codes.blue}maestro new ${ + codes.bold + codes.red +}project_name${codes.reset} Create a new Maestro project. - Run ${codes.italic + codes.blue}maestro new${ + Run ${codes.italic + codes.blue}maestro new ${ codes.bold + codes.red }project_name${codes.reset} to create a new maestro project with the given project name. @@ -106,7 +113,7 @@ const helpMsg = `maestro-help: ${codes.italic + codes.blue}maestro help ${ codes.reset } for more information.`; -const defaultMsg = `Run \`${codes.italic + codes.blue}maestro help${ +const defaultMsg = `Run \`${codes.italic + codes.blue}maestro help ${ codes.bold + codes.red }command${codes.reset}\` to get help specific to a subcommand.`; From 280a40d73e2489958d1a4857f2b67578c8d49821 Mon Sep 17 00:00:00 2001 From: John Isom Date: Sat, 29 Aug 2020 17:22:08 -0600 Subject: [PATCH 12/17] Add --help/-h flag --- bin/maestro.js | 58 +++++++++++++++++++++----------------------- src/commands/help.js | 5 ++-- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/bin/maestro.js b/bin/maestro.js index 8d58fcb..52fce7b 100755 --- a/bin/maestro.js +++ b/bin/maestro.js @@ -3,44 +3,42 @@ const minimist = require("minimist"); const argv = minimist(process.argv.slice(2), { - boolean: ["force", "n"], + boolean: ["force", "n", "help"], string: ["roles", "template"], alias: { f: "force", t: "template", + h: "help", }, default: { roles: "", }, }); -const defaultMsg = `See man pages for commands: -maestro(1) -maestro-config(1) -maestro-deploy(1) -maestro-teardown(1) -maestro-new(1) -maestro-get-templates(1)`; - -switch (argv._[0]) { - case "config": - require("../src/commands/config")(); - break; - case "deploy": - require("../src/commands/deploy")(); - break; - case "teardown": - require("../src/commands/teardown")(argv); - break; - case "new": - require("../src/commands/newProject")(argv); - break; - case "get-templates": - require("../src/commands/getTemplates")(); - break; - case "help": - require("../src/commands/help")(argv); - break; - default: - console.log(defaultMsg); +if (argv.help) { + require("../src/commands/help")(argv._[0]); +} else { + switch (argv._[0]) { + case "config": + require("../src/commands/config")(); + break; + case "deploy": + require("../src/commands/deploy")(); + break; + case "teardown": + require("../src/commands/teardown")(argv); + break; + case "new": + require("../src/commands/newProject")(argv); + break; + case "get-templates": + require("../src/commands/getTemplates")(); + break; + case "help": + require("../src/commands/help")(argv._[1]); + break; + default: + require("../src/commands/help")(); + break; + } } diff --git a/src/commands/help.js b/src/commands/help.js index fd8d8ed..8f2cbd2 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -1,6 +1,5 @@ /* TODO: -- add support for a `--help/-h` flag to any subcommand - create man page for maestro-help(1) - add flag usage for commands that need it */ @@ -117,8 +116,8 @@ const defaultMsg = `Run \`${codes.italic + codes.blue}maestro help ${ codes.bold + codes.red }command${codes.reset}\` to get help specific to a subcommand.`; -const help = (argv) => { - switch (argv._[1]) { +const help = (command) => { + switch (command) { case undefined: console.log(defaultMsg); break; From ef45b9568a20e30e66e921f17f0f13e959c902c5 Mon Sep 17 00:00:00 2001 From: John Isom Date: Sat, 29 Aug 2020 17:31:44 -0600 Subject: [PATCH 13/17] Fill out man page for maestro-help(1) --- doc/man/maestro-help.1 | 46 ++++++++++++++++++++++++++++++++++++------ src/commands/help.js | 1 - 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/doc/man/maestro-help.1 b/doc/man/maestro-help.1 index a8340d0..58390a7 100644 --- a/doc/man/maestro-help.1 +++ b/doc/man/maestro-help.1 @@ -14,12 +14,6 @@ maestro \- display help information about maestro or maestro command .B maestro [\fIcommand\fR] \fB\-h\fR|\fB\-\-help\fR -.SH DESCRIPTION - -.SH OPTIONS - -.SH NOTES - .SH BUGS .PP @@ -30,6 +24,46 @@ the GitHub Issues page .SH EXAMPLE +.SS Using the --help flag + +.PP +This shows an example of running +.IR "maestro --help" . + +.PP +.RS +.EX +$ \fBmaestro config --help\fR +maestro-config: \fImaestro config\fR + Set up or alter your Maestro configuration files. + + Run \fImaestro config\fR to set the global config values of AWS account number and + region. + + See manual page \fBmaestro-config(1)\fR for more information. +.EE +.RE + +.SS Using the help subcommand + +.PP +This shows an example of running +.IR "maestro help " . + +.PP +.RS +.EX +$ \fBmaestro help config\fR +maestro-config: \fImaestro config\fR + Set up or alter your Maestro configuration files. + + Run \fImaestro config\fR to set the global config values of AWS account number and + region. + + See manual page \fBmaestro-config(1)\fR for more information. +.EE +.RE + .SH SEE ALSO .BR maestro (1), diff --git a/src/commands/help.js b/src/commands/help.js index 8f2cbd2..70e1627 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -1,6 +1,5 @@ /* TODO: -- create man page for maestro-help(1) - add flag usage for commands that need it */ From 91ccca9309e44b836a0b1a1e401f0de719e40b18 Mon Sep 17 00:00:00 2001 From: John Isom Date: Sat, 29 Aug 2020 17:41:35 -0600 Subject: [PATCH 14/17] Add flag/options usage for maestro-new --- src/commands/help.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/commands/help.js b/src/commands/help.js index 70e1627..2307879 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -64,6 +64,8 @@ const teardownMsg = `maestro-teardown: ${ } for more information.`; const newMsg = `maestro-new: ${codes.italic + codes.blue}maestro new ${ + codes.reset +}[${codes.italic + codes.bold + codes.red}options ${codes.reset}...] ${ codes.bold + codes.red }project_name${codes.reset} Create a new Maestro project. @@ -75,6 +77,19 @@ const newMsg = `maestro-new: ${codes.italic + codes.blue}maestro new ${ When this command is executed a prompt is displayed listing all of the available templates on which to base this new project. + Options: + -n, --no-template + Don't use a template for the new project. + + -t ${codes.italic + codes.bold + codes.red}template_name${codes.reset}, + --template ${codes.italic + codes.bold + codes.red}template_name${ + codes.reset +}, + --template=${codes.italic + codes.bold + codes.red}template_name${ + codes.reset +} + Use a specific template for the new project. + See manual page ${codes.yellow + codes.bold}maestro-new(1)${ codes.reset } for more information.`; From ad1601c1385395f8c300bd5d1169f95098a0240d Mon Sep 17 00:00:00 2001 From: John Isom Date: Sat, 29 Aug 2020 17:47:17 -0600 Subject: [PATCH 15/17] Add flag/options usage for maestro-teardown --- src/commands/help.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/commands/help.js b/src/commands/help.js index 2307879..9728339 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -50,7 +50,9 @@ const deployMsg = `maestro-deploy: ${codes.italic + codes.blue}maestro deploy${ const teardownMsg = `maestro-teardown: ${ codes.italic + codes.blue -}maestro teardown${codes.reset} +}maestro teardown${codes.reset} [${ + codes.italic + codes.bold + codes.red +}options${codes.reset} ...] Teardown an existing Maestro project. Run ${codes.italic + codes.blue}maestro teardown${ @@ -59,6 +61,14 @@ const teardownMsg = `maestro-teardown: ${ the project's resources including AWS Lambdas, the AWS Step Functions state machine, and optionally AWS IAM Roles. + Options: + -f, --force + Do not prompt for confirmation. + + --roles ${codes.italic + codes.bold + codes.red}role1${codes.reset}[,${codes.italic + codes.bold + codes.red}role2${codes.reset}...], + --roles=${codes.italic + codes.bold + codes.red}role1${codes.reset}[,${codes.italic + codes.bold + codes.red}role2${codes.reset}...] + Specify the roles to be deleted in addition to the other resources. + See manual page ${codes.yellow + codes.bold}maestro-teardown(1)${ codes.reset } for more information.`; From 1dd2da32bafef293b81c9dfa341f8999178c6ae2 Mon Sep 17 00:00:00 2001 From: John Isom Date: Sat, 29 Aug 2020 17:48:02 -0600 Subject: [PATCH 16/17] Remove TODO comments --- src/commands/help.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/commands/help.js b/src/commands/help.js index 9728339..4c16fd6 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -1,8 +1,3 @@ -/* -TODO: -- add flag usage for commands that need it -*/ - const codes = { reset: "\033[m", bold: "\033[1m", From 0a8f315b1e6593ac556badca338c5f1c9c252f16 Mon Sep 17 00:00:00 2001 From: John Isom Date: Sun, 30 Aug 2020 12:05:28 -0600 Subject: [PATCH 17/17] Format help.js to prettierjs standards --- src/commands/help.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/commands/help.js b/src/commands/help.js index 4c16fd6..cf96118 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -60,8 +60,12 @@ const teardownMsg = `maestro-teardown: ${ -f, --force Do not prompt for confirmation. - --roles ${codes.italic + codes.bold + codes.red}role1${codes.reset}[,${codes.italic + codes.bold + codes.red}role2${codes.reset}...], - --roles=${codes.italic + codes.bold + codes.red}role1${codes.reset}[,${codes.italic + codes.bold + codes.red}role2${codes.reset}...] + --roles ${codes.italic + codes.bold + codes.red}role1${codes.reset}[,${ + codes.italic + codes.bold + codes.red +}role2${codes.reset}...], + --roles=${codes.italic + codes.bold + codes.red}role1${codes.reset}[,${ + codes.italic + codes.bold + codes.red +}role2${codes.reset}...] Specify the roles to be deleted in addition to the other resources. See manual page ${codes.yellow + codes.bold}maestro-teardown(1)${