func New() *metl { // signal handling -- gracefully handle ctrl+c when running a job Etl = &metl{ app: cli.New("", "mini ETL system", func(c cli.Command) { c.Usage() }), runnables: make(map[string]Runnable), } return Etl }
// // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package main import ( "github.com/boundary/cascade/command" "github.com/jwaldrip/odin/cli" ) var cascade = cli.New("0.0.1", "cascade", cli.ShowUsage) func init() { cascade.AddSubCommands( command.Cm, command.Node, command.Role, command.Service, ) } func main() { cascade.Start() }
package main import "github.com/jwaldrip/odin/cli" var app = cli.New(version, "a command line DSL for go-lang", cli.ShowUsage) func main() { app.Start() }
"os" "path/filepath" "strings" ) const ( envKey = storage.EnvKey envUser = storage.EnvUser version = "1.1" cacheFilename = "~selct.cache~" + version envCache = "SELECTEL_CACHE" envContainer = "SELECTEL_CONTAINER" ) var ( client = cli.New(version, "Selectel storage command line client", connect) user, key string container string api storage.API debug bool cache bool cacheSecure bool errorNotEnough = errors.New("Not enought arguments") ) func encryptionKey() []byte { hasher := sha256.New() hasher.Write([]byte("selectel storage command line client")) hasher.Write([]byte(key)) hasher.Write([]byte(user)) return hasher.Sum(nil)
package main import ( "os" "github.com/jwaldrip/odin/cli" ) import "fmt" import "strings" // Create a new cli application var app = cli.New("1.0.0", "A simple tool to greet with", greet, "greeting") func init() { // define a flag called --loudly and also alias it to -l app.DefineBoolFlag("loudly", false, "say loudly") app.AliasFlag('l', "loudly") // define a flag called --color and also alias it to -c app.DefineStringFlag("color", "blue", "color the output (red, blue, green)") app.AliasFlag('c', "color") // add a sub command `to` that takes one param called `greetee` subcmd := app.DefineSubCommand("to", "greet a person", greetGreetee, "greetee") subcmd.AliasName("two", "to") subcmd.SetLongDescription(` Say a greeting to a specific persion Example: $ greet-with hello to jerry hello jerry