Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use carapace-pflag #1293

Merged
merged 1 commit into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
69 changes: 32 additions & 37 deletions completers/ant_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,43 @@ var rootCmd = &cobra.Command{
}

func Execute() error {
carapace.Override(carapace.Opts{
LongShorthand: true,
})
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()

rootCmd.Flags().Bool("-execdebug", false, "print ant exec line generated by this launch script")
rootCmd.Flags().Bool("-h", false, "print this message and ant help")
rootCmd.Flags().Bool("-help", false, "print this message and ant help")
rootCmd.Flags().Bool("-noconfig", false, "suppress sourcing of configuration files")
rootCmd.Flags().Bool("-usejikes", false, "enable use of jikes by default, unless set explicitly in configuration files")
rootCmd.Flags().Bool("autoproxy", false, "Java1.5+: use the OS proxy settings")
rootCmd.Flags().String("buildfile", "", "use given buildfile")
rootCmd.Flags().Bool("debug", false, "print debugging information")
rootCmd.Flags().Bool("diagnostics", false, "print information that might be helpful to")
rootCmd.Flags().Bool("emacs", false, "produce logging information without adornments")
rootCmd.Flags().String("f", "", "use given buildfile")
rootCmd.Flags().String("file", "", "use given buildfile")
rootCmd.Flags().String("find", "", "(s)earch for buildfile towards the root of")
rootCmd.Flags().Bool("help", false, "print this message and exit")
rootCmd.Flags().String("inputhandler", "", "the class which will handle input requests")
rootCmd.Flags().Bool("k", false, "execute all targets that do not depend on failed target(s)")
rootCmd.Flags().Bool("keep-going", false, "execute all targets that do not depend on failed target(s)")
rootCmd.Flags().String("l", "", "use given file for log")
rootCmd.Flags().String("lib", "", "specifies a path to search for jars and classes")
rootCmd.Flags().String("listener", "", "add an instance of class as a project listener")
rootCmd.Flags().String("logfile", "", "use given file for log")
rootCmd.Flags().String("logger", "", "the class which is to perform logging")
rootCmd.Flags().String("main", "", "override Ant's normal entry point")
rootCmd.Flags().String("nice", "", "A niceness value for the main thread")
rootCmd.Flags().Bool("noclasspath", false, "Run ant without using CLASSPATH")
rootCmd.Flags().Bool("noinput", false, "do not allow interactive input")
rootCmd.Flags().Bool("nouserlib", false, "Run ant without using the jar files from ${user.home}/.ant/lib")
rootCmd.Flags().Bool("projecthelp", false, "print project help information and exit")
rootCmd.Flags().String("propertyfile", "", "load all properties from file with -D properties taking precedence")
rootCmd.Flags().Bool("quiet", false, "be extra quiet")
rootCmd.Flags().String("s", "", "(s)earch for buildfile towards the root of")
rootCmd.Flags().Bool("silent", false, "print nothing but task outputs and build failures")
rootCmd.Flags().Bool("verbose", false, "be extra verbose")
rootCmd.Flags().Bool("version", false, "print the version information and exit")
rootCmd.Flags().BoolS("autoproxy", "autoproxy", false, "Java1.5+: use the OS proxy settings")
rootCmd.Flags().StringS("buildfile", "buildfile", "", "use given buildfile")
rootCmd.Flags().BoolS("debug", "debug", false, "print debugging information")
rootCmd.Flags().BoolS("diagnostics", "diagnostics", false, "print information that might be helpful to")
rootCmd.Flags().BoolS("emacs", "emacs", false, "produce logging information without adornments")
rootCmd.Flags().Bool("execdebug", false, "print ant exec line generated by this launch script")
rootCmd.Flags().StringS("f", "f", "", "use given buildfile")
rootCmd.Flags().StringS("file", "file", "", "use given buildfile")
rootCmd.Flags().StringS("find", "find", "", "(s)earch for buildfile towards the root of")
rootCmd.Flags().BoolS("help", "help", false, "print this message and exit")
rootCmd.Flags().StringS("inputhandler", "inputhandler", "", "the class which will handle input requests")
rootCmd.Flags().BoolS("k", "k", false, "execute all targets that do not depend on failed target(s)")
rootCmd.Flags().BoolS("keep-going", "keep-going", false, "execute all targets that do not depend on failed target(s)")
rootCmd.Flags().StringS("l", "l", "", "use given file for log")
rootCmd.Flags().StringS("lib", "lib", "", "specifies a path to search for jars and classes")
rootCmd.Flags().StringS("listener", "listener", "", "add an instance of class as a project listener")
rootCmd.Flags().StringS("logfile", "logfile", "", "use given file for log")
rootCmd.Flags().StringS("logger", "logger", "", "the class which is to perform logging")
rootCmd.Flags().StringS("main", "main", "", "override Ant's normal entry point")
rootCmd.Flags().StringS("nice", "nice", "", "A niceness value for the main thread")
rootCmd.Flags().BoolS("noclasspath", "noclasspath", false, "Run ant without using CLASSPATH")
rootCmd.Flags().Bool("noconfig", false, "suppress sourcing of configuration files")
rootCmd.Flags().BoolS("noinput", "noinput", false, "do not allow interactive input")
rootCmd.Flags().BoolS("nouserlib", "nouserlib", false, "Run ant without using the jar files from ${user.home}/.ant/lib")
rootCmd.Flags().BoolS("projecthelp", "projecthelp", false, "print project help information and exit")
rootCmd.Flags().StringS("propertyfile", "propertyfile", "", "load all properties from file with -D properties taking precedence")
rootCmd.Flags().BoolS("quiet", "quiet", false, "be extra quiet")
rootCmd.Flags().StringS("s", "s", "", "(s)earch for buildfile towards the root of")
rootCmd.Flags().BoolS("silent", "silent", false, "print nothing but task outputs and build failures")
rootCmd.Flags().Bool("usejikes", false, "enable use of jikes by default, unless set explicitly in configuration files")
rootCmd.Flags().BoolS("verbose", "verbose", false, "be extra verbose")
rootCmd.Flags().BoolS("version", "version", false, "print the version information and exit")

// TODO class completions
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
Expand Down
33 changes: 15 additions & 18 deletions completers/dmenu_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,28 @@ var rootCmd = &cobra.Command{
}

func Execute() error {
carapace.Override(carapace.Opts{
LongShorthand: true,
})
return rootCmd.Execute()
}

func init() {
carapace.Gen(rootCmd).Standalone()

rootCmd.Flags().Bool("b", false, "dmenu appears at the bottom of the screen.")
rootCmd.Flags().Bool("f", false, "dmenu grabs the keyboard before reading stdin if not reading from a tty.")
rootCmd.Flags().String("fn", "", "defines the font or font set used.")
rootCmd.Flags().String("h", "", "dmenu uses a menu line of at least 'height' pixels tall, but no less than 8.")
rootCmd.Flags().Bool("i", false, "dmenu matches menu items case insensitively.")
rootCmd.Flags().String("l", "", "dmenu lists items vertically, with the given number of lines.")
rootCmd.Flags().String("m", "", "dmenu is displayed on the monitor number supplied.")
rootCmd.Flags().String("nb", "", "defines the normal background color.")
rootCmd.Flags().String("nf", "", "defines the normal foreground color.")
rootCmd.Flags().String("p", "", "defines the prompt to be displayed to the left of the input field.")
rootCmd.Flags().String("sb", "", "defines the selected background color.")
rootCmd.Flags().String("sf", "", "defines the selected foreground color.")
rootCmd.Flags().BoolS("b", "b", false, "dmenu appears at the bottom of the screen.")
rootCmd.Flags().BoolS("f", "f", false, "dmenu grabs the keyboard before reading stdin if not reading from a tty.")
rootCmd.Flags().StringS("fn", "fn", "", "defines the font or font set used.")
rootCmd.Flags().StringS("h", "h", "", "dmenu uses a menu line of at least 'height' pixels tall, but no less than 8.")
rootCmd.Flags().BoolS("i", "i", false, "dmenu matches menu items case insensitively.")
rootCmd.Flags().StringS("l", "l", "", "dmenu lists items vertically, with the given number of lines.")
rootCmd.Flags().StringS("m", "m", "", "dmenu is displayed on the monitor number supplied.")
rootCmd.Flags().StringS("nb", "nb", "", "defines the normal background color.")
rootCmd.Flags().StringS("nf", "nf", "", "defines the normal foreground color.")
rootCmd.Flags().StringS("p", "p", "", "defines the prompt to be displayed to the left of the input field.")
rootCmd.Flags().StringS("sb", "sb", "", "defines the selected background color.")
rootCmd.Flags().StringS("sf", "sf", "", "defines the selected foreground color.")
rootCmd.Flags().BoolS("v", "v", false, "prints version information to stdout, then exits.")
rootCmd.Flags().String("w", "", "sets the width of the dmenu window.")
rootCmd.Flags().String("x", "", "dmenu is placed at this offset measured from the left side of the monitor.")
rootCmd.Flags().String("y", "", "dmenu is placed at this offset measured from the top of the monitor.")
rootCmd.Flags().StringS("w", "w", "", "sets the width of the dmenu window.")
rootCmd.Flags().StringS("x", "x", "", "dmenu is placed at this offset measured from the left side of the monitor.")
rootCmd.Flags().StringS("y", "y", "", "dmenu is placed at this offset measured from the top of the monitor.")

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"nb": action.ActionColors(),
Expand Down
35 changes: 16 additions & 19 deletions completers/dms_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,27 @@ var rootCmd = &cobra.Command{
}

func Execute() error {
carapace.Override(carapace.Opts{
LongShorthand: true,
})
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()

rootCmd.Flags().String("allowedIps", "", "allowed ip of clients, separated by comma")
rootCmd.Flags().String("config", "", "json configuration file")
rootCmd.Flags().String("deviceIcon", "", "device icon")
rootCmd.Flags().String("fFprobeCachePath", "", "path to FFprobe cache file (default \"~/.dms-ffprobe-cache\")")
rootCmd.Flags().String("forceTranscodeTo", "", "force transcoding to certain format, supported: 'chromecast', 'vp8', 'web'")
rootCmd.Flags().String("friendlyName", "", "server friendly name")
rootCmd.Flags().String("http", "", "http server port (default \":1338\")")
rootCmd.Flags().String("ifname", "", "specific SSDP network interface")
rootCmd.Flags().Bool("ignoreHidden", false, "ignore hidden files and directories")
rootCmd.Flags().Bool("ignoreUnreadable", false, "ignore unreadable files and directories")
rootCmd.Flags().Bool("logHeaders", false, "log HTTP headers")
rootCmd.Flags().Bool("noProbe", false, "disable media probing with ffprobe")
rootCmd.Flags().Bool("noTranscode", false, "disable transcoding")
rootCmd.Flags().String("notifyInterval", "", "interval between SSPD announces (default 30s)")
rootCmd.Flags().String("path", "", "browse root path")
rootCmd.Flags().Bool("stallEventSubscribe", false, "workaround for some bad event subscribers")
rootCmd.Flags().StringS("allowedIps", "allowedIps", "", "allowed ip of clients, separated by comma")
rootCmd.Flags().StringS("config", "config", "", "json configuration file")
rootCmd.Flags().StringS("deviceIcon", "deviceIcon", "", "device icon")
rootCmd.Flags().StringS("fFprobeCachePath", "fFprobeCachePath", "", "path to FFprobe cache file (default \"~/.dms-ffprobe-cache\")")
rootCmd.Flags().StringS("forceTranscodeTo", "forceTranscodeTo", "", "force transcoding to certain format, supported: 'chromecast', 'vp8', 'web'")
rootCmd.Flags().StringS("friendlyName", "friendlyName", "", "server friendly name")
rootCmd.Flags().StringS("http", "http", "", "http server port (default \":1338\")")
rootCmd.Flags().StringS("ifname", "ifname", "", "specific SSDP network interface")
rootCmd.Flags().BoolS("ignoreHidden", "ignoreHidden", false, "ignore hidden files and directories")
rootCmd.Flags().BoolS("ignoreUnreadable", "ignoreUnreadable", false, "ignore unreadable files and directories")
rootCmd.Flags().BoolS("logHeaders", "logHeaders", false, "log HTTP headers")
rootCmd.Flags().BoolS("noProbe", "noProbe", false, "disable media probing with ffprobe")
rootCmd.Flags().BoolS("noTranscode", "noTranscode", false, "disable transcoding")
rootCmd.Flags().StringS("notifyInterval", "notifyInterval", "", "interval between SSPD announces (default 30s)")
rootCmd.Flags().StringS("path", "path", "", "browse root path")
rootCmd.Flags().BoolS("stallEventSubscribe", "stallEventSubscribe", false, "workaround for some bad event subscribers")

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"config": carapace.ActionFiles(".json"),
Expand Down
33 changes: 15 additions & 18 deletions completers/elvish_completer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,26 @@ var rootCmd = &cobra.Command{
}

func Execute() error {
carapace.Override(carapace.Opts{
LongShorthand: true,
})
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()

rootCmd.Flags().Bool("buildinfo", false, "Output information about the Elvish build and quit")
rootCmd.Flags().Bool("c", false, "Treat the first argument as code to execute")
rootCmd.Flags().Bool("compileonly", false, "Parse and compile Elvish code without executing it")
rootCmd.Flags().Bool("daemon", false, "[internal flag] Run the storage daemon instead of an Elvish shell")
rootCmd.Flags().String("db", "", "[internal flag] Path to the database file")
rootCmd.Flags().String("deprecation-level", "", "Show warnings for all features deprecated as of version 0.X (default 18)")
rootCmd.Flags().Bool("help", false, "Show usage help and quit")
rootCmd.Flags().Bool("i", false, "A no-op flag, introduced for POSIX compatibility")
rootCmd.Flags().Bool("json", false, "Show the output from -buildinfo, -compileonly or -version in JSON")
rootCmd.Flags().String("log", "", "Path to a file to write debug logs")
rootCmd.Flags().Bool("lsp", false, "Run the builtin language server")
rootCmd.Flags().Bool("norc", false, "Don't read the RC file when running interactively")
rootCmd.Flags().String("rc", "", "Path to the RC file when running interactively")
rootCmd.Flags().String("sock", "", "[internal flag] Path to the daemon's UNIX socket")
rootCmd.Flags().Bool("version", false, "Output the Elvish version and quit")
rootCmd.Flags().BoolS("buildinfo", "buildinfo", false, "Output information about the Elvish build and quit")
rootCmd.Flags().BoolS("c", "c", false, "Treat the first argument as code to execute")
rootCmd.Flags().BoolS("compileonly", "compileonly", false, "Parse and compile Elvish code without executing it")
rootCmd.Flags().BoolS("daemon", "daemon", false, "[internal flag] Run the storage daemon instead of an Elvish shell")
rootCmd.Flags().StringS("db", "db", "", "[internal flag] Path to the database file")
rootCmd.Flags().StringS("deprecation-level", "deprecation-level", "", "Show warnings for all features deprecated as of version 0.X (default 18)")
rootCmd.Flags().BoolS("help", "help", false, "Show usage help and quit")
rootCmd.Flags().BoolS("i", "i", false, "A no-op flag, introduced for POSIX compatibility")
rootCmd.Flags().BoolS("json", "json", false, "Show the output from -buildinfo, -compileonly or -version in JSON")
rootCmd.Flags().StringS("log", "log", "", "Path to a file to write debug logs")
rootCmd.Flags().BoolS("lsp", "lsp", false, "Run the builtin language server")
rootCmd.Flags().BoolS("norc", "norc", false, "Don't read the RC file when running interactively")
rootCmd.Flags().StringS("rc", "rc", "", "Path to the RC file when running interactively")
rootCmd.Flags().StringS("sock", "sock", "", "[internal flag] Path to the daemon's UNIX socket")
rootCmd.Flags().BoolS("version", "version", false, "Output the Elvish version and quit")

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"db": carapace.ActionFiles(),
Expand Down