Go-flags wireframing demo

Overview

go-flags-demo

All Contributors

MIT License GoDoc Go Report Card Build Status PoweredBy WireFrame

redo - global option redo

Redo global option via automatic code-gen

TOC

go-flags-demo - global option redo

go-flags-demo will redo global option via automatic code-gen

$ go-flags-demo -V
redo - global option redo
Copyright (C) 2022, Myself <[email protected]>

Redo global option via automatic code-gen

Built on 2022-01-22
Version 0.1.0

Synopsis

All the Go code under this project were automatically generated.

Check out easygen cli code-gen example for go-flags on how to do it.

Usage

$ go-flags-demo || true
Please specify one command of: build, install or publish

Usage:
  go-flags-demo [OPTIONS] <build | install | publish>

Application Options:
  -H, --host=    Host address (default: localhost) [$REDO_HOST]
  -p, --port=    Listening port (default: 80) [$REDO_PORT]
  -f, --force    Force start [$REDO_FORCE]
  -v, --verbose  Verbose mode (Multiple -v options increase the verbosity)
  -V, --version  Show program version and exit

Help Options:
  -h, --help     Show this help message

Available commands:
  build    Build the network application
  install  Install the network application
  publish  Publish the network application

Development History

The following are the demos while the wireframed was developed (thus having the executable name of wireframed):

Demo

$ wireframed
Please specify one command of: build, install or publish

Usage:
  wireframed [OPTIONS] <build | install | publish>

Application Options:
  -H, --host=    host address (default: localhost) [$REDO_HOST]
  -p, --port=    listening port (default: 80) [$REDO_PORT]
  -f, --force    force start [$REDO_FORCE]
  -v, --verbose  Verbose mode (Multiple -v options increase the verbosity)

Help Options:
  -h, --help     Show this help message

Available commands:
  build    Build the network application
  install  Install the network application
  publish  Publish the network application



$ wireframed publish
the required flag `-d, --dir' was not specified

Usage:
  wireframed [OPTIONS] publish [publish-OPTIONS] ID Num Rest...

Publish the built network application to central repo

Application Options:
  -H, --host=       host address (default: localhost) [$REDO_HOST]
  -p, --port=       listening port (default: 80) [$REDO_PORT]
  -f, --force       force start [$REDO_FORCE]
  -v, --verbose     Verbose mode (Multiple -v options increase the verbosity)

Help Options:
  -h, --help        Show this help message

[publish command options]
      -d, --dir=    publish dir
          --suffix= source file suffix (default: .go,.c,.s)
      -o, --out=    output filename



$ wireframed publish -d .
the required arguments `ID` and `Num` were not provided

Usage:
  wireframed [OPTIONS] publish [publish-OPTIONS] ID Num Rest...

Publish the built network application to central repo

Application Options:
  -H, --host=       host address (default: localhost) [$REDO_HOST]
  -p, --port=       listening port (default: 80) [$REDO_PORT]
  -f, --force       force start [$REDO_FORCE]
  -v, --verbose     Verbose mode (Multiple -v options increase the verbosity)

Help Options:
  -h, --help        Show this help message

[publish command options]
      -d, --dir=    publish dir
          --suffix= source file suffix (default: .go,.c,.s)
      -o, --out=    output filename



$ wireframed publish -d ../dist v1 123 abc def
Publish the network application
Copyright (C) 2022, Myself 
    

Doing Publish, with []string{}
../dist .go,.c,.s  {v1 123 [abc def]}

The last two lines are output from:

	fmt.Printf("Doing Publish, with %#v\n", args)
	fmt.Println(x.Dir, x.Suffix, x.Out, x.Args)
$ wireframed install --dir ../new abc def
Install the network application
Copyright (C) 2022, Myself <[email protected]>

Doing Install, with []string{"abc", "def"}
../new .go,.c,.s

Update 1

After ouput global option,

$ wireframed publish -d ../dist v1 123 abc def
Publish the network application
Copyright (C) 2022, Myself <[email protected]>

Doing Publish, with {Host:localhost Port:80 Force:false Verbflg:0x4a8120 Verbose:0}, []
../dist .go,.c,.s  {v1 123 [abc def]}



$ REDO_HOST=myserver REDO_PORT=8080 wireframed publish -v -d ../dist v1 123 abc def
Publish the network application
Copyright (C) 2022, Myself <[email protected]>

Doing Publish, with {Host:myserver Port:8080 Force:false Verbflg:0x4a8120 Verbose:1}, []
../dist .go,.c,.s  {v1 123 [abc def]}



$ REDO_HOST=myserver REDO_PORT=8080 wireframed publish -vv -H newserver --port 8888 --force -d ../dist v1 123 abc def
Publish the network application
Copyright (C) 2022, Myself <[email protected]>

Doing Publish, with {Host:newserver Port:8888 Force:true Verbflg:0x4a8120 Verbose:2}, []
../dist .go,.c,.s  {v1 123 [abc def]}

Update 2

After turning --suffix to use choices.

$ wireframed publish
the required flag `-d, --dir' was not specified

Usage:
  wireframed [OPTIONS] publish [publish-OPTIONS] ID Num Rest...

Publish the built network application to central repo

Application Options:
  -H, --host=                  host address (default: localhost) [$REDO_HOST]
  -p, --port=                  listening port (default: 80) [$REDO_PORT]
  -f, --force                  force start [$REDO_FORCE]
  -v, --verbose                Verbose mode (Multiple -v options increase the verbosity)

Help Options:
  -h, --help                   Show this help message

[publish command options]
      -d, --dir=               publish dir
      -s, --suffix=[.go|.c|.h] source file suffix for publish
      -o, --out=               output filename

# see that the --suffix= now use choices



$ wireframed publish -d ../dist v1 123 abc def
Publish the network application
Copyright (C) 2022, Myself 
    

Doing Publish, with {Host:localhost Port:80 Force:false Verbflg:0x4a8180 Verbose:0}, []
../dist []  {v1 123 [abc def]}

# the --suffix= has empty choices by default



$ wireframed publish -d ../dist -s .c -s .h v1 123 abc def
Publish the network application
Copyright (C) 2022, Myself 
    

Doing Publish, with {Host:localhost Port:80 Force:false Verbflg:0x4a8180 Verbose:0}, []
../dist [.c .h]  {v1 123 [abc def]}

# the --suffix= has two choices now



$ wireframed publish -d ../dist -s .x v1 123 abc def
Invalid value `.x' for option `-s, --suffix'. Allowed values are: .go, .c or .h

Usage:
  wireframed . . .

# when the --suffix= has been provided with wrong choice

Update 3

After switching to go-easygen which has clis support functions,

$ wireframed install -v
Install the network application
Copyright (C) 2022, Myself <[email protected]>

[redo::install] Doing Install, with {Host:localhost Port:80 Force:false Verbflg:0x4a92e0 Verbose:1}, []

./ .go,.c,.s
[redo::install] Warning: Install, Exec, Sample warning: Instance not found
  • The clis.Verbose(1, will only output if the Verbose level is >=1.
  • Removing the -v option from the command line the "Doing Install" line will disappear.
  • With clis.WarnOn & clis.AbortOn reporting warning or critical errors (in color) will be a breeze.

Update on 2022-01-22

After update to new template, which uses -V, --version to show program version,

$ wireframed
Please specify one command of: build, install or publish

Usage:
  wireframed [OPTIONS] <build | install | publish>

Application Options:
  -H, --host=    Host address (default: localhost) [$REDO_HOST]
  -p, --port=    Listening port (default: 80) [$REDO_PORT]
  -f, --force    Force start [$REDO_FORCE]
  -v, --verbose  Verbose mode (Multiple -v options increase the verbosity)
  -V, --version  Show program version and exit

Help Options:
  -h, --help     Show this help message

Available commands:
  build    Build the network application
  install  Install the network application
  publish  Publish the network application

$ wireframed -V
redo - global option redo
Copyright (C) 2022, Myself <[email protected]>

Redo global option via automatic code-gen

Built on 2022-01-22
Version 0.1.0

Download/install binaries

  • The latest binary executables are available as the result of the Continuous-Integration (CI) process.
  • I.e., they are built automatically right from the source code at every git release by GitHub Actions.
  • There are two ways to get/install such binary executables
    • Using the binary executables directly, or
    • Using packages for your distro

The binary executables

  • The latest binary executables are directly available under
    https://github.com/go-easygen/go-flags-demo/releases/latest
  • Pick & choose the one that suits your OS and its architecture. E.g., for Linux, it would be the go-flags-demo_verxx_linux_amd64.tar.gz file.
  • Available OS for binary executables are
    • Linux
    • Mac OS (darwin)
    • Windows
  • If your OS and its architecture is not available in the download list, please let me know and I'll add it.
  • The manual installation is just to unpack it and move/copy the binary executable to somewhere in PATH. For example,
tar -xvf go-flags-demo_*_linux_amd64.tar.gz
sudo mv -v go-flags-demo_*_linux_amd64/go-flags-demo /usr/local/bin/
rmdir -v go-flags-demo_*_linux_amd64

Distro package

The repo setup instruction url has been given above. For example, for Debian --

Debian package

curl -1sLf \
  'https://dl.cloudsmith.io/public/suntong/repo/setup.deb.sh' \
  | sudo -E bash

# That's it. You then can do your normal operations, like

sudo apt-get update
apt-cache policy go-flags-demo

sudo apt-get install -y go-flags-demo

Install Source

To install the source code instead:

go get -v -u github.com/go-easygen/go-flags-demo

Author

Tong SUN
suntong from cpan.org

Powered by WireFrame
PoweredBy WireFrame
the one-stop wire-framing solution for Go cli based projects, from init to deploy.

Idiomatic Go input parsing with subcommands, positional values, and flags at any position. No required project or package layout and no external dependencies.

Sensible and fast command-line flag parsing with excellent support for subcommands and positional values. Flags can be at any position. Flaggy has no

Eric Greer 805 Aug 16, 2022
Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

Description pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. pflag is compatible with the GNU extensions to

Steve Francia 1.9k Aug 9, 2022
Generate flags by parsing structures

Flags based on structures. The sflags package uses structs, reflection and struct field tags to allow you specify command line options. It supports di

null 140 Aug 1, 2022
A rich tool for parsing flags and values in pure Golang

A rich tool for parsing flags and values in pure Golang. No additional library is required and you can use everywhere.

ALi.w 14 Jan 25, 2022
Prompts users to enter values for required flags in Cobra CLI applications

Cobra Flag Prompt Cobra Flag Prompt prompts users to enter values for required flags. It is an extension of Cobra, and requires that you use Cobra to

null 1 Nov 13, 2021
A go1.18 wrapper to provide simple generics based API for defining command line flags.

gflag A go1.18 wrapper to provide simple generics based API for defining command line flags. Example package main import ( "flag" "fmt" "time" "

Clifton Kaznocha 0 Dec 20, 2021
archy is an static binary to determine current kernel and machine architecture, with backwards compatible flags to uname, and offers alternative output format of Go runtime (i.e. GOOS, GOARCH).

archy archy is an simple binary to determine current kernel and machine architecture, which wraps uname and alternatively can read from Go runtime std

xargs-dev 3 Mar 18, 2022
Golang Bubble Tea Weather Demo

Golang Bubble Tea Weather Demo Demo weather app writen in Golang using Bubble Tea. Video Instructions go mod download go build ./go-tea-weather Discl

Nicolás Parada 10 Jul 31, 2022
TXQR (Animated QR data transfer) demo reader app for iOS

TXQR Reader for iOS txqr-reader is a demo app in Swift that reads animated QR code and shows file. Currently it expects file to be an JPEG image. Just

Ivan Daniluk 83 Aug 1, 2022
A CLI tool for OS demo.

NTHU-OS-Demo A CLI tool for OS demo. Powered by spf13/cobra, pterm/pterm, martinlindhe/imgcat and AlecAivazis/survey. Note that imgcat only support on

null 0 Dec 27, 2021
A CLI tool for OS demo.

NTHU-OS-Demo A CLI tool for OS demo. Powered by spf13/cobra, pterm/pterm, martinlindhe/imgcat and AlecAivazis/survey. Note that imgcat only support on

LSA Lab, National Tsing Hua University 0 Dec 26, 2021
Restful services on a Go application integrated with mongodb. Articles demo application.

article-app Restful Go services demo integrated with MongoDB by Cahit Ünver article-app is a GO application integrated with MongoDB. Application is a

Cahit Ünver 0 Jan 17, 2022
Golang-demo - A repo for app golang-demo; bootstrapped by DevStream

golang-demo This is a repo for app golang-demo; bootstrapped by DevStream. By de

Daniel Hu 0 Mar 1, 2022
False-sharing-demo - Demo for performance effects of CPU cache false-sharing

Example of CPU cache false-sharing in Go. A simple example where 2 integer varia

glebarez 2 Jun 3, 2022
Litestream-read-replica-demo - A demo application for running live read replication on fly.io with Litestream

Litestream Read Replica Demo A demo application for running live read replicatio

Ben Johnson 67 Aug 6, 2022
Automatically sets up command line flags based on struct fields and tags.

Commandeer Commandeer sets up command line flags based on struct fields and tags. Do you... like to develop Go apps as libraries with tiny main packag

Matthew Jaffee 158 Jul 12, 2022
Idiomatic Go input parsing with subcommands, positional values, and flags at any position. No required project or package layout and no external dependencies.

Sensible and fast command-line flag parsing with excellent support for subcommands and positional values. Flags can be at any position. Flaggy has no

Eric Greer 805 Aug 16, 2022
Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

Description pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. pflag is compatible with the GNU extensions to

Steve Francia 1.9k Aug 9, 2022
Generate flags by parsing structures

Flags based on structures. The sflags package uses structs, reflection and struct field tags to allow you specify command line options. It supports di

null 140 Aug 1, 2022
Library for setting values to structs' fields from env, flags, files or default tag

Configuration is a library for injecting values recursively into structs - a convenient way of setting up a configuration object. Available features:

Bogdan Daragan 73 Jul 25, 2022
persistent storage for flags in go

ingo is a simple Go library helping you to persist flags in a ini-like config file. Features and limitations Requires Go 1.5 or later automatically cr

null 36 Jun 22, 2022
getopt-like flags package for golang,

goopt A getopt-like processor of command-line flags. It works much like the "flag" package, only it processes arguments in a way that is compatible wi

David Roundy 82 Aug 2, 2022
Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

Description pflag is a drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. pflag is compatible with the GNU extensions to

Alex Ogier 519 Aug 5, 2022
Flags-first package for configuration

ff stands for flags-first, and provides an opinionated way to populate a flag.FlagSet with configuration data from the environment.

Peter Bourgon 1k Aug 6, 2022
A rich tool for parsing flags and values in pure Golang

A rich tool for parsing flags and values in pure Golang. No additional library is required and you can use everywhere.

ALi.w 14 Jan 25, 2022
A kubectl plugin for finding decoded secret data with productive search flags.

kubectl-secret-data What is it? This is a kubectl plugin for finding decoded secret data. Since kubectl only outputs base64-encoded secrets, it makes

Keisuke Umegaki 37 Jul 18, 2022
A kubectl plugin for finding decoded secret data with productive search flags.

kubectl-secret-data What is it? This is a kubectl plugin for finding decoded secret data. Since kubectl outputs base64-encoded secrets basically, it m

Keisuke Umegaki 37 Jul 18, 2022
Expressive flags for Go

Expressive flags for Go Package xflags provides an alternative to Go's flag package for defining and parsing command line arguments with an emphasis o

The Cavalier Gopher 17 Mar 15, 2022