Skip to content

Commit

Permalink
use carapace-parse to generate initial skeleton
Browse files Browse the repository at this point in the history
- pipe all the 'tox subcommand --help' outputs to carapace-parse
- some minor manual editing
  • Loading branch information
samuelallan72 committed Jun 29, 2024
1 parent 704b078 commit b39976e
Show file tree
Hide file tree
Showing 11 changed files with 403 additions and 0 deletions.
39 changes: 39 additions & 0 deletions completers/tox_completer/cmd/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)

var configCmd = &cobra.Command{
Use: "config",
Short: "show tox configuration",
Run: func(cmd *cobra.Command, args []string) {},
}

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

configCmd.Flags().StringS("e", "e", "", "enumerate (ALL -> all environments, not set -> use <env_list> from config) (default: <env_list>)")
configCmd.Flags().String("colored", "", "should output be enriched with colors, default is yes unless TERM=dumb or NO_COLOR is defined. (default: no)")
configCmd.Flags().Bool("core", false, "show core options (by default is hidden unless -e ALL is passed) (default: False)")
configCmd.Flags().Bool("develop", false, "install package in development mode (default: False)")
configCmd.Flags().String("exit-and-dump-after", "", "")
configCmd.Flags().String("hashseed", "", "set PYTHONHASHSEED to SEED before running commands. Defaults to a random integer in the range [1, 4294967295] ([1, 1024] on Windows). Passing 'notset' suppresses this behavior. (default: 264197440)")
configCmd.Flags().BoolP("help", "h", false, "show this help message and exit")
configCmd.Flags().Bool("list-dependencies", false, "list the dependencies installed during environment setup (default: False)")
configCmd.Flags().Bool("no-list-dependencies", false, "never list the dependencies installed during environment setup (default: True)")
configCmd.Flags().String("no-provision", "", "do not perform provision, but fail and if a path was provided write provision metadata as JSON to it (default: False)")
configCmd.Flags().Bool("no-recreate-pkg", false, "if recreate is set do not recreate packaging tox environment(s) (default: False)")
configCmd.Flags().Bool("no-recreate-provision", false, "if recreate is set do not recreate provision tox environment (default: False)")
configCmd.Flags().BoolP("quiet", "q", false, "decrease verbosity (default: 0)")
configCmd.Flags().BoolP("recreate", "r", false, "recreate the tox environments (default: False)")
configCmd.Flags().String("root", "", "project root directory (if not specified will be the folder of the config file) (default: None)")
configCmd.Flags().String("runner", "", "the tox run engine to use when not explicitly stated in tox env configuration (default: virtualenv)")
configCmd.Flags().String("skip-env", "", "exclude all environments selected that match this regular expression (default: )")
configCmd.Flags().BoolP("verbose", "v", false, "increase verbosity (default: 2)")
configCmd.Flags().Bool("version", false, "show program's and plugins version number and exit")
configCmd.Flags().String("workdir", "", "tox working directory (if not specified will be the folder of the config file) (default: None)")

rootCmd.AddCommand(configCmd)
}
31 changes: 31 additions & 0 deletions completers/tox_completer/cmd/depends.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)

var dependsCmd = &cobra.Command{
Use: "depends",
Short: "visualize tox environment dependencies",
Run: func(cmd *cobra.Command, args []string) {},
}

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

dependsCmd.Flags().String("colored", "", "should output be enriched with colors, default is yes unless TERM=dumb or NO_COLOR is defined. (default: no)")
dependsCmd.Flags().String("exit-and-dump-after", "", "")
dependsCmd.Flags().BoolP("help", "h", false, "show this help message and exit")
dependsCmd.Flags().String("no-provision", "", "do not perform provision, but fail and if a path was provided write provision metadata as JSON to it (default: False)")
dependsCmd.Flags().Bool("no-recreate-provision", false, "if recreate is set do not recreate provision tox environment (default: False)")
dependsCmd.Flags().BoolP("quiet", "q", false, "decrease verbosity (default: 0)")
dependsCmd.Flags().BoolP("recreate", "r", false, "recreate the tox environments (default: False)")
dependsCmd.Flags().String("root", "", "project root directory (if not specified will be the folder of the config file) (default: None)")
dependsCmd.Flags().String("runner", "", "the tox run engine to use when not explicitly stated in tox env configuration (default: virtualenv)")
dependsCmd.Flags().BoolP("verbose", "v", false, "increase verbosity (default: 2)")
dependsCmd.Flags().Bool("version", false, "show program's and plugins version number and exit")
dependsCmd.Flags().String("workdir", "", "tox working directory (if not specified will be the folder of the config file) (default: None)")

rootCmd.AddCommand(dependsCmd)
}
38 changes: 38 additions & 0 deletions completers/tox_completer/cmd/devenv.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)

var devenvCmd = &cobra.Command{
Use: "devenv",
Short: "sets up a development environment at ENVDIR based on the tox configuration specified",
Run: func(cmd *cobra.Command, args []string) {},
}

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

devenvCmd.Flags().StringS("e", "e", "", "environment to run (default: py)")
devenvCmd.Flags().String("colored", "", "should output be enriched with colors, default is yes unless TERM=dumb or NO_COLOR is defined. (default: no)")
devenvCmd.Flags().String("exit-and-dump-after", "", "")
devenvCmd.Flags().String("hashseed", "", "set PYTHONHASHSEED to SEED before running commands. Defaults to a random integer in the range [1, 4294967295] ([1, 1024] on Windows). Passing 'notset' suppresses this behavior. (default: 3925389505)")
devenvCmd.Flags().BoolP("help", "h", false, "show this help message and exit")
devenvCmd.Flags().Bool("list-dependencies", false, "list the dependencies installed during environment setup (default: False)")
devenvCmd.Flags().Bool("no-list-dependencies", false, "never list the dependencies installed during environment setup (default: True)")
devenvCmd.Flags().String("no-provision", "", "do not perform provision, but fail and if a path was provided write provision metadata as JSON to it (default: False)")
devenvCmd.Flags().Bool("no-recreate-pkg", false, "if recreate is set do not recreate packaging tox environment(s) (default: False)")
devenvCmd.Flags().Bool("no-recreate-provision", false, "if recreate is set do not recreate provision tox environment (default: False)")
devenvCmd.Flags().BoolP("quiet", "q", false, "decrease verbosity (default: 0)")
devenvCmd.Flags().BoolP("recreate", "r", false, "recreate the tox environments (default: False)")
devenvCmd.Flags().String("result-json", "", "write a JSON file with detailed information about all commands and results involved (default: None)")
devenvCmd.Flags().String("root", "", "project root directory (if not specified will be the folder of the config file) (default: None)")
devenvCmd.Flags().String("runner", "", "the tox run engine to use when not explicitly stated in tox env configuration (default: virtualenv)")
devenvCmd.Flags().String("skip-env", "", "exclude all environments selected that match this regular expression (default: )")
devenvCmd.Flags().BoolP("verbose", "v", false, "increase verbosity (default: 2)")
devenvCmd.Flags().Bool("version", false, "show program's and plugins version number and exit")
devenvCmd.Flags().String("workdir", "", "tox working directory (if not specified will be the folder of the config file) (default: None)")

rootCmd.AddCommand(devenvCmd)
}
43 changes: 43 additions & 0 deletions completers/tox_completer/cmd/exec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)

var execCmd = &cobra.Command{
Use: "exec",
Short: "execute an arbitrary command within a tox environment",
Run: func(cmd *cobra.Command, args []string) {},
}

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

execCmd.Flags().StringS("e", "e", "", "environment to run (default: py)")
execCmd.Flags().String("colored", "", "should output be enriched with colors, default is yes unless TERM=dumb or NO_COLOR is defined. (default: no)")
execCmd.Flags().Bool("develop", false, "install package in development mode (default: False)")
execCmd.Flags().String("exit-and-dump-after", "", "")
execCmd.Flags().String("hashseed", "", "set PYTHONHASHSEED to SEED before running commands. Defaults to a random integer in the range [1, 4294967295] ([1, 1024] on Windows). Passing 'notset' suppresses this behavior. (default: 2416698050)")
execCmd.Flags().BoolP("help", "h", false, "show this help message and exit")
execCmd.Flags().String("installpkg", "", "use specified package for installation into venv, instead of packaging the project (default: None)")
execCmd.Flags().Bool("list-dependencies", false, "list the dependencies installed during environment setup (default: False)")
execCmd.Flags().Bool("no-list-dependencies", false, "never list the dependencies installed during environment setup (default: True)")
execCmd.Flags().String("no-provision", "", "do not perform provision, but fail and if a path was provided write provision metadata as JSON to it (default: False)")
execCmd.Flags().Bool("no-recreate-pkg", false, "if recreate is set do not recreate packaging tox environment(s) (default: False)")
execCmd.Flags().Bool("no-recreate-provision", false, "if recreate is set do not recreate provision tox environment (default: False)")
execCmd.Flags().BoolP("notest", "n", false, "do not run the test commands (default: False)")
execCmd.Flags().StringP("pkg-only,", "b", "", "")
execCmd.Flags().BoolP("quiet", "q", false, "decrease verbosity (default: 0)")
execCmd.Flags().BoolP("recreate", "r", false, "recreate the tox environments (default: False)")
execCmd.Flags().String("result-json", "", "write a JSON file with detailed information about all commands and results involved (default: None)")
execCmd.Flags().String("root", "", "project root directory (if not specified will be the folder of the config file) (default: None)")
execCmd.Flags().String("runner", "", "the tox run engine to use when not explicitly stated in tox env configuration (default: virtualenv)")
execCmd.Flags().String("skip-env", "", "exclude all environments selected that match this regular expression (default: )")
execCmd.Flags().Bool("skip-pkg-install", false, "skip package installation for this run (default: False)")
execCmd.Flags().BoolP("verbose", "v", false, "increase verbosity (default: 2)")
execCmd.Flags().Bool("version", false, "show program's and plugins version number and exit")
execCmd.Flags().String("workdir", "", "tox working directory (if not specified will be the folder of the config file) (default: None)")

rootCmd.AddCommand(execCmd)
}
54 changes: 54 additions & 0 deletions completers/tox_completer/cmd/legacy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)

var legacyCmd = &cobra.Command{
Use: "tox",
Short: "legacy entry-point command",
Run: func(cmd *cobra.Command, args []string) {},
}

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

legacyCmd.Flags().StringS("e", "e", "", "enumerate (ALL -> all environments, not set -> use <env_list> from config) (default: <env_list>)")
legacyCmd.Flags().Bool("alwayscopy", false, "deprecated use VIRTUALENV_ALWAYS_COPY=1, override always copy setting to True in all envs (default: False)")
legacyCmd.Flags().String("colored", "", "should output be enriched with colors, default is yes unless TERM=dumb or NO_COLOR is defined. (default: no)")
legacyCmd.Flags().Bool("develop", false, "install package in development mode (default: False)")
legacyCmd.Flags().String("devenv", "", "sets up a development environment at ENVDIR based on the env's tox configuration specified by`-e` (-e defaults to py) (default: None)")
legacyCmd.Flags().String("exit-and-dump-after", "", "")
legacyCmd.Flags().String("force-dep", "", "Forces a certain version of one of the dependencies when configuring the virtual environment. REQ Examples 'pytest<6.1' or 'django>=2.2'. (default: [])")
legacyCmd.Flags().String("hashseed", "", "set PYTHONHASHSEED to SEED before running commands. Defaults to a random integer in the range [1, 4294967295] ([1, 1024] on Windows). Passing 'notset' suppresses this behavior. (default: 2745445130)")
legacyCmd.Flags().BoolP("help", "h", false, "show this help message and exit")
legacyCmd.Flags().String("help-ini,", "", "show live configuration (default: False)")
legacyCmd.Flags().String("installpkg", "", "use specified package for installation into venv, instead of packaging the project (default: None)")
legacyCmd.Flags().Bool("list-dependencies", false, "list the dependencies installed during environment setup (default: False)")
legacyCmd.Flags().BoolP("listenvs", "l", false, "show list of test environments (with description if verbose) (default: False)")
legacyCmd.Flags().BoolP("listenvs-all", "a", false, "show list of all defined environments (with description if verbose) (default: False)")
legacyCmd.Flags().Bool("no-list-dependencies", false, "never list the dependencies installed during environment setup (default: True)")
legacyCmd.Flags().String("no-provision", "", "do not perform provision, but fail and if a path was provided write provision metadata as JSON to it (default: False)")
legacyCmd.Flags().Bool("no-recreate-pkg", false, "if recreate is set do not recreate packaging tox environment(s) (default: False)")
legacyCmd.Flags().Bool("no-recreate-provision", false, "if recreate is set do not recreate provision tox environment (default: False)")
legacyCmd.Flags().BoolP("notest", "n", false, "do not run the test commands (default: False)")
legacyCmd.Flags().BoolP("parallel-live", "o", false, "connect to stdout while running environments (default: False)")
legacyCmd.Flags().Bool("parallel-no-spinner", false, "run tox environments in parallel, but don't show the spinner, implies --parallel (default: False)")
legacyCmd.Flags().StringP("pkg-only,", "b", "", "")
legacyCmd.Flags().Bool("pre", false, "deprecated use PIP_PRE in set_env instead - install pre-releases and development versions ofdependencies; this will set PIP_PRE=1 environment variable (default: False)")
legacyCmd.Flags().BoolP("quiet", "q", false, "decrease verbosity (default: 0)")
legacyCmd.Flags().BoolP("recreate", "r", false, "recreate the tox environments (default: False)")
legacyCmd.Flags().String("result-json", "", "write a JSON file with detailed information about all commands and results involved (default: None)")
legacyCmd.Flags().String("root", "", "project root directory (if not specified will be the folder of the config file) (default: None)")
legacyCmd.Flags().String("runner", "", "the tox run engine to use when not explicitly stated in tox env configuration (default: virtualenv)")
legacyCmd.Flags().Bool("showconfig", false, "show live configuration (by default all env, with -l only default targets, specific via TOXENV/-e) (default: False)")
legacyCmd.Flags().Bool("sitepackages", false, "deprecated use VIRTUALENV_SYSTEM_SITE_PACKAGES=1, override sitepackages setting to True in all envs (default: False)")
legacyCmd.Flags().String("skip-env", "", "exclude all environments selected that match this regular expression (default: )")
legacyCmd.Flags().Bool("skip-pkg-install", false, "skip package installation for this run (default: False)")
legacyCmd.Flags().BoolP("verbose", "v", false, "increase verbosity (default: 2)")
legacyCmd.Flags().Bool("version", false, "show program's and plugins version number and exit")
legacyCmd.Flags().String("workdir", "", "tox working directory (if not specified will be the folder of the config file) (default: None)")

rootCmd.AddCommand(legacyCmd)
}
34 changes: 34 additions & 0 deletions completers/tox_completer/cmd/list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)

var listCmd = &cobra.Command{
Use: "list",
Short: "list environments",
Run: func(cmd *cobra.Command, args []string) {},
}

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

listCmd.Flags().BoolS("d", "d", false, "list just default envs (default: False)")
listCmd.Flags().String("colored", "", "should output be enriched with colors, default is yes unless TERM=dumb or NO_COLOR is defined. (default: no)")
listCmd.Flags().String("exit-and-dump-after", "", "")
listCmd.Flags().BoolP("help", "h", false, "show this help message and exit")
listCmd.Flags().Bool("no-desc", false, "do not show description (default: False)")
listCmd.Flags().String("no-provision", "", "do not perform provision, but fail and if a path was provided write provision metadata as JSON to it (default: False)")
listCmd.Flags().Bool("no-recreate-provision", false, "if recreate is set do not recreate provision tox environment (default: False)")
listCmd.Flags().BoolP("quiet", "q", false, "decrease verbosity (default: 0)")
listCmd.Flags().BoolP("recreate", "r", false, "recreate the tox environments (default: False)")
listCmd.Flags().String("root", "", "project root directory (if not specified will be the folder of the config file) (default: None)")
listCmd.Flags().String("runner", "", "the tox run engine to use when not explicitly stated in tox env configuration (default: virtualenv)")
listCmd.Flags().String("skip-env", "", "exclude all environments selected that match this regular expression (default: )")
listCmd.Flags().BoolP("verbose", "v", false, "increase verbosity (default: 2)")
listCmd.Flags().Bool("version", false, "show program's and plugins version number and exit")
listCmd.Flags().String("workdir", "", "tox working directory (if not specified will be the folder of the config file) (default: None)")

rootCmd.AddCommand(listCmd)
}
33 changes: 33 additions & 0 deletions completers/tox_completer/cmd/list2.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package cmd

import (
"github.com/carapace-sh/carapace"
"github.com/spf13/cobra"
)

var listCmd = &cobra.Command{
Use: "list",
Short: "list environments",
Run: func(cmd *cobra.Command, args []string) {},
}

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

listCmd.Flags().BoolS("d", "d", false, "list just default envs (default: False)")
listCmd.Flags().String("colored", "", "should output be enriched with colors, default is yes unless TERM=dumb or NO_COLOR is defined. (default: no)")
listCmd.Flags().String("exit-and-dump-after", "", "")
listCmd.Flags().BoolP("help", "h", false, "show this help message and exit")
listCmd.Flags().Bool("no-desc", false, "do not show description (default: False)")
listCmd.Flags().String("no-provision", "", "do not perform provision, but fail and if a path was provided write provision metadata as JSON to it (default: False)")
listCmd.Flags().Bool("no-recreate-provision", false, "if recreate is set do not recreate provision tox environment (default: False)")
listCmd.Flags().BoolP("quiet", "q", false, "decrease verbosity (default: 0)")
listCmd.Flags().BoolP("recreate", "r", false, "recreate the tox environments (default: False)")
listCmd.Flags().String("root", "", "project root directory (if not specified will be the folder of the config file) (default: None)")
listCmd.Flags().String("runner", "", "the tox run engine to use when not explicitly stated in tox env configuration (default: virtualenv)")
listCmd.Flags().String("skip-env", "", "exclude all environments selected that match this regular expression (default: )")
listCmd.Flags().BoolP("verbose", "v", false, "increase verbosity (default: 2)")
listCmd.Flags().Bool("version", false, "show program's and plugins version number and exit")
listCmd.Flags().String("workdir", "", "tox working directory (if not specified will be the folder of the config file) (default: None)")
rootCmd.AddCommand(listCmd)
}
Loading

0 comments on commit b39976e

Please sign in to comment.