Giter Club home page Giter Club logo

cli-ng's People

Contributors

datadrake avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cli-ng's Issues

Need to support Localization

Localization should be defined that is specific to cli-ng first, with enough generic functionality to also be used by the applications which are based on cli-ng.

Localization should be defined using the Weblate-supported nested-json format.
https://docs.weblate.org/en/latest/formats.html#json-files

Something like:

{
	"cli-ng": {
		"usage": "USAGE",
		"cmd": "CMD",
		"desc": "DESCRIPTION"
	},
	"cli-ng-root": {
		"flag-name": "name",
		"flag-name-desc": "This is name"
	},
	"cli-ng-subcommand": {
		"arg-name": "name",
		"arg-name-desc": "this is name",
		"flag-name2": "name2",
		"flag-name2-desc": "This is name2"
	}
}

Weblate testing is needed for > 2 levels of nesting. Docs are unclear. If possible, more like:

{
	"cli-ng": {
		"usage": "USAGE",
		"cmd": "CMD",
		"desc": "DESCRIPTION",
		"arg": "arg",
		"cmds": {
			"root": {
				"short": "root command description",
				"flags": {
					"name1": {
						"short": "n",
						"long": "long-name",
						"desc": "This is name"
					}
				}
			},
			"subcommand": {
				"name": "subcommand1",
				"alias": "sc",
				"short": "this is subcommand1",
				"args": {
					"name2": {
						"name": "name2",
						"desc": "this is name2"
					}
				},
				"flags": {
					"name3": {
						"short": "N",
						"long": "long-name3",
						"desc": "this is name3"
					}
				}
			}
		}
	}
}

Support for Nested Subcommands?

Hey @DataDrake,

On one of the projects I'm working on I'd kinda love to be able to nest subcommands. For example,

hyprspace peers add

hyprspace peers remove

Where hyprspace is the name of the program, peers is the top level subcommand, and add/remove are children of peers.

Looking around I didn't see an obvious way to do this in cli-ng but, perhaps I'm just not looking in the right place? If this isn't already implemented, would this be something you are interested in?

Fails to build as dependency of Cuppa

Trying to package cuppa for Void Linux and running into this error.

# github.com/DataDrake/cli-ng/translate
_build-cuppa-xbps/src/github.com/DataDrake/cli-ng/translate/en_US.go:29:10: cannot use enUS (type string) as type []byte in argument to po.Parse

Full log

Add support for hidden subcommands

Not really an easter egg sort of thing. It would be nice to have hidden subcommands for things like:

  • Generating translation files
  • Generating man pages
  • Handling completions

Add completion support

No, we aren't going to generate a bash completion script. We should have a hidden "completions" subcommand which may be called from a light-weight script to adapt it to Bash and other shells.

Question: support for append?

If I wanted to use the equivalent of the Python append argument, how would that look? E.g., I'd want to be able to do:

./executable <command> --metric one --metric two ... --metric N

The alternative is provide one string separated by commas, which isn't as nice an interface. it's also not appropriate to use a list of args because I'm already using it for something else. Thank you!

Add man page support

It's inevitable that someone will want to see us generating man pages. This should be implemented as a simple text\template which dumps out a man page in the default locale. These man pages should mirror how git does them: one man page for the whole utility, referencing individual man pages for each non-hidden subcommand (e.g. git-commit).

Allow specifying flags without long and short

At the moment, you must specify the long and short as struct tags for a flag in order for them to be usable. Ideally it should default to the struct field name being lowercased.

Add support for Arg slices

The argument struct for a subcommand should be able to have the last argument be a slice of one of the other supported types. This allows the command to take a list of arguments rather than just one argument per struct entry.

Add support for an optional arguments

Subcommands should be allowed to be called without any arguments, even if they are specified. This allows a single subcommand to be used to operate on a specific thing or all things. In conjunction with slice args, any number of arguments 0...N can therefore be supported.

Args field in CMD cannot be unassigned

When creating a new cmd.CMD, if the Args field is left unassigned, the program fails with the following stack trace:

panic: reflect: call of reflect.Value.Elem on zero Value

goroutine 1 [running]:
reflect.Value.Elem(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /usr/lib64/golang/src/reflect/value.go:842 +0x1a5
github.com/DataDrake/cli-ng/options.(*Parser).SetArgs(0xc00000e0a0, 0x0, 0x0, 0x7)
        /home/serebit/Code/Go/pkg/mod/github.com/!data!drake/[email protected]/options/parser.go:161 +0xc8
github.com/DataDrake/cli-ng/cmd.(*RootCMD).Run(0x5e6b00)
        /home/serebit/Code/Go/pkg/mod/github.com/!data!drake/[email protected]/cmd/root.go:122 +0x14d
main.main()
        /home/serebit/Code/Go/qol-assist/main.go:20 +0x2d

Setting Args to &struct{}{} works around this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.