diff --git a/ROADMAP.md b/ROADMAP.md index 339588c..a2b8ec8 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -7,6 +7,7 @@ This is road map of `gcli`, what I'm doing for next release and planing for futu - `godoc` - More document for flag - Global option for command pattern +- **Done**: Generate bash script - **Done**: More verbose outputs in `skeleton` package - **Done** `go vet` tests for artifacts - **Done**: `list` command diff --git a/command/list.go b/command/list.go index a846949..e60870f 100644 --- a/command/list.go +++ b/command/list.go @@ -29,6 +29,9 @@ func (c *ListCommand) Run(args []string) int { header := []string{"Name", "Command", "URL"} table.SetHeader(header) for _, f := range skeleton.Frameworks { + if f.Hide { + continue + } var cmd string if len(f.CommandTemplates) > 0 { cmd = "*" diff --git a/command/new.go b/command/new.go index e6ac261..9b41ae7 100644 --- a/command/new.go +++ b/command/new.go @@ -155,7 +155,7 @@ func (c *NewCommand) Run(args []string) int { case artifact := <-artifactCh: c.UI.Output(fmt.Sprintf(" Created %s", artifact)) case err := <-errCh: - c.UI.Error("Failed to generate %s: " + err.Error()) + c.UI.Error(fmt.Sprintf("Failed to generate %s: %s", output, err.Error())) // If some file are created before error happend // Should be cleanuped diff --git a/skeleton/framework.go b/skeleton/framework.go index 3df4680..27e9556 100644 --- a/skeleton/framework.go +++ b/skeleton/framework.go @@ -21,6 +21,10 @@ type Framework struct { // CommandTemplate CommandTemplates []Template + + // If Hide is true, `list` command doesn't show + // this framework + Hide bool } // CommonTemplates is collection of templates which are used all frameworks. @@ -83,6 +87,18 @@ The goal is to enable developers to write fast and distributable command line ap }, }, + { + Name: "bash", + URL: "", + Description: ` +`, + BaseTemplates: []Template{ + {"resource/tmpl/bash/main.sh.tmpl", "{{ .Name }}.sh"}, + }, + CommandTemplates: []Template{}, + Hide: true, + }, + { Name: "flag", AltNames: []string{}, diff --git a/skeleton/resource/tmpl/bash/main.sh.tmpl b/skeleton/resource/tmpl/bash/main.sh.tmpl new file mode 100755 index 0000000..6c3c29b --- /dev/null +++ b/skeleton/resource/tmpl/bash/main.sh.tmpl @@ -0,0 +1,101 @@ +#!/bin/bash +# +# {{ .Name }} +# +# Copyright (c) {{ date }} {{.Owner}} +# + +readonly PROGNAME=$(basename $0) +readonly COMMAND=$1 + +usage() { + cat <