refactor(commands): separate commands and its core into two folders (#32)

- I think it would be better if one for commands only, one for the spec
handling core logic so people won't be confused by the core logic inside
the commands folder (cleaner I guess)
- Regen docs
This commit is contained in:
VERSE
2026-07-05 11:27:30 +07:00
committed by GitHub
parent 6b98455957
commit ebde9ba68f
536 changed files with 2241 additions and 2241 deletions
+3 -3
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "black",
Description: "Version",
Options: []core.Option{
Options: []spec.Option{
{Name: "--code", Description: "Format the code passed in as a string"},
{Name: "--line-length", Description: "How many characters per line to allow"},
{Name: "--target-version", Description: "Python versions that should be supported"},
+4 -4
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "conda",
Description: "Name of environment",
Subcommands: []core.Subcommand{
Subcommands: []spec.Subcommand{
{Name: "activate", Description: "Activate an environment"},
{Name: "deactivate", Description: "Deactivate an environment"},
{Name: "clean", Description: "Remove unused packages and caches"},
@@ -32,7 +32,7 @@ func init() {
{Name: "upgrade", Description: "Alias for conda update"},
{Name: "files", Description: "Package files to convert"},
},
Options: []core.Option{
Options: []spec.Option{
{Name: "-n", Description: "Name of environment"},
{Name: "-p", Description: "Full path to environment location (i.e. prefix)"},
{Name: "--dev", Description: "Use locally built packages. Identical to '-c local'"},
+4 -4
View File
@@ -1,17 +1,17 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "django-admin",
Description: "Show this help message and exit",
Subcommands: []core.Subcommand{
Subcommands: []spec.Subcommand{
{Name: "help", Description: "Usage and help information for django-admin"},
},
Options: []core.Option{
Options: []spec.Option{
{Name: "-h", Description: "Show this help message and exit"},
{Name: "--version", Description: "Show program's version number and exit"},
{Name: "-v", Description: "Raise on CommandError exceptions"},
+3 -3
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "googler",
Description: "Google from the command-line",
Options: []core.Option{
Options: []spec.Option{
{Name: "-h", Description: "Show this help message and exit"},
{Name: "-s", Description: "Start at the Nth result"},
{Name: "-n", Description: "Show N results"},
+4 -4
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "jupyter",
Description: "Set log level to logging.DEBUG (maximize logging output)",
Subcommands: []core.Subcommand{
Subcommands: []spec.Subcommand{
{Name: "bundlerextension", Description: "Work with Jupyter bundler extensions"},
{Name: "enable", Description: "Enable a bundler extension"},
{Name: "disable", Description: "Disable a bundler extension"},
@@ -27,7 +27,7 @@ func init() {
{Name: "troubleshoot", Description: "Log for troubleshooting"},
{Name: "trust", Description: "Manage trust"},
},
Options: []core.Option{
Options: []spec.Option{
{Name: "--debug", Description: "Set log level to logging.DEBUG (maximize logging output)"},
{Name: "-h", Description: "Show this message"},
{Name: "--log-level", Description: "Set the log level by value or name"},
+4 -4
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "mamba",
Description: "Mamba is a fast, robust, and cross-platform package manager",
Subcommands: []core.Subcommand{
Subcommands: []spec.Subcommand{
{Name: "activate", Description: "Activate an environment"},
{Name: "deactivate", Description: "Deactivate an environment"},
{Name: "clean", Description: "Remove unused packages and caches"},
@@ -37,7 +37,7 @@ func init() {
{Name: "xtl", Description: "List packages that require xtl package"},
{Name: "env", Description: "Manage environments"},
},
Options: []core.Option{
Options: []spec.Option{
{Name: "-n", Description: "Name of environment"},
{Name: "-p", Description: "Full path to environment location (i.e. prefix)"},
{Name: "--file", Description: "Use locally built packages. Identical to '-c local'"},
+3 -3
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "mypy",
Description: "Mypy is a static type checker for Python",
Options: []core.Option{
Options: []spec.Option{
{Name: "--module", Description: "Asks mypy to type check the provided module"},
{Name: "--package", Description: "Asks mypy to type check the provided package"},
{Name: "--command", Description: "Asks mypy to type check the provided string as a program"},
+12 -12
View File
@@ -6,10 +6,10 @@ import (
"strings"
"time"
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func pipPackageGenerator(tokens []string, _ string, _ string) []core.Suggestion {
func pipPackageGenerator(tokens []string, _ string, _ string) []spec.Suggestion {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
@@ -24,7 +24,7 @@ func pipPackageGenerator(tokens []string, _ string, _ string) []core.Suggestion
}
}
var results []core.Suggestion
var results []spec.Suggestion
for line := range strings.SplitSeq(string(out), "\n") {
line = strings.TrimSpace(line)
if line == "" {
@@ -37,17 +37,17 @@ func pipPackageGenerator(tokens []string, _ string, _ string) []core.Suggestion
if len(parts) == 2 {
desc = "v" + parts[1]
}
results = append(results, core.Suggestion{Cmd: name, Desc: desc})
results = append(results, spec.Suggestion{Cmd: name, Desc: desc})
}
return results
}
func makePipSpec(name string) *core.Spec {
return &core.Spec{
func makePipSpec(name string) *spec.Spec {
return &spec.Spec{
Name: name,
Description: "python packages",
Subcommands: []core.Subcommand{
{Name: "install", Description: "install package", Options: []core.Option{
Subcommands: []spec.Subcommand{
{Name: "install", Description: "install package", Options: []spec.Option{
{Name: "-r", Description: "from requirements file"},
{Name: "-U", Description: "upgrade"},
{Name: "--user", Description: "install for user only"},
@@ -55,11 +55,11 @@ func makePipSpec(name string) *core.Spec {
{Name: "--index-url", Description: "custom package index"},
{Name: "--no-deps", Description: "skip dependencies"},
}},
{Name: "uninstall", Description: "remove package", Generator: pipPackageGenerator, Options: []core.Option{
{Name: "uninstall", Description: "remove package", Generator: pipPackageGenerator, Options: []spec.Option{
{Name: "-y", Description: "yes to all prompts"},
}},
{Name: "freeze", Description: "list installed packages"},
{Name: "list", Description: "list installed", Options: []core.Option{
{Name: "list", Description: "list installed", Options: []spec.Option{
{Name: "--outdated", Description: "show outdated"},
{Name: "--format", Description: "output format"},
}},
@@ -76,6 +76,6 @@ func makePipSpec(name string) *core.Spec {
}
func init() {
core.Register(makePipSpec("pip"))
core.Register(makePipSpec("pip3"))
spec.Register(makePipSpec("pip"))
spec.Register(makePipSpec("pip3"))
}
+4 -4
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "pipenv",
Description: "Python package manager",
Subcommands: []core.Subcommand{
Subcommands: []spec.Subcommand{
{Name: "clean", Description: "Uninstalls all packages not specified in Pipfile.lock"},
{Name: "graph", Description: "Displays currently-installed dependency graph information"},
{Name: "install", Description: "Initializes a package manager or installs all packages from Pipfile"},
@@ -23,7 +23,7 @@ func init() {
{Name: "uninstall", Description: "Uninstalls a provided package and removes it from Pipfile"},
{Name: "update", Description: "Runs lock, then sync"},
},
Options: []core.Option{
Options: []spec.Option{
{Name: "--unused", Description: "Given a code path, show potentially unused dependencies"},
{Name: "--db", Description: "Ignore specified vulnerability during PyUp Safety checks"},
{Name: "--output", Description: "Translates to --json, --full-report or --bare from PyUp Safety check"},
+4 -4
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "pipx",
Description: "Installed package",
Subcommands: []core.Subcommand{
Subcommands: []spec.Subcommand{
{Name: "install", Description: "Install a package"},
{Name: "package_spec", Description: "Package name or pip installation spec"},
{Name: "inject", Description: "Installs packages to an existing pipx-managed virtual environment"},
@@ -24,7 +24,7 @@ func init() {
{Name: "environment", Description: "Print a list of variables used in pipx.constants"},
{Name: "completions", Description: "Print instructions on enabling shell completions for pipx"},
},
Options: []core.Option{
Options: []spec.Option{
{Name: "--include-deps", Description: "Include apps of dependent packages"},
{Name: "--force", Description: "Modify existing virtual environment and files in PIPX_BIN_DIR"},
{Name: "--suffix", Description: "Optional suffix for virtual environment and executable names"},
+4 -4
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "pre-commit",
Description: "Show help message and exit",
Subcommands: []core.Subcommand{
Subcommands: []spec.Subcommand{
{Name: "autoupdate", Description: "Auto-update pre-commit config to the latest repos' versions"},
{Name: "clean", Description: "Clean out pre-commit files"},
{Name: "gc", Description: "Clean unused cached repos"},
@@ -23,7 +23,7 @@ func init() {
{Name: "uninstall", Description: "Uninstall the pre-commit script"},
{Name: "help", Description: "Show help for a specific command"},
},
Options: []core.Option{
Options: []spec.Option{
{Name: "-h", Description: "Show help message and exit"},
{Name: "--color", Description: "Whether to use color in output. Defaults to `auto`"},
{Name: "--config", Description: "Path to alternate config file"},
+4 -4
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "pyenv",
Description: "Pyenv",
Subcommands: []core.Subcommand{
Subcommands: []spec.Subcommand{
{Name: "commands", Description: "Lists all available pyenv commands"},
{Name: "local", Description: "Sets a local application-specific Python version"},
{Name: "global", Description: "Sets the global version of Python to be used in all shells"},
@@ -18,7 +18,7 @@ func init() {
{Name: "rehash", Description: "Performs a deployment (default)"},
{Name: "whence", Description: "Lists all Python versions with the given command installed"},
},
Options: []core.Option{
Options: []spec.Option{
{Name: "-h", Description: "Output usage information"},
{Name: "--unset", Description: "Sets the global version of Python to be used in all shells"},
{Name: "-l", Description: "List all available versions"},
+3 -3
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "pytest",
Description: "Control assertion debugging tools.",
Options: []core.Option{
Options: []spec.Option{
{Name: "--assert", Description: "Remove all cache contents at start of test run"},
{Name: "--cache-show", Description: "Per-test capturing method"},
{Name: "--code-highlight", Description: "Whether code should be highlighted (only if --color is also enabled)"},
+22 -22
View File
@@ -1,15 +1,15 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func makePythonSpec(name string) *core.Spec {
return &core.Spec{
func makePythonSpec(name string) *spec.Spec {
return &spec.Spec{
Name: name,
Description: "python interpreter",
Generator: core.FileGenerator(".py"),
Options: []core.Option{
Generator: spec.FileGenerator(".py"),
Options: []spec.Option{
{Name: "-m", Description: "run module as script"},
{Name: "-c", Description: "run inline command"},
{Name: "-i", Description: "interactive after script"},
@@ -23,27 +23,27 @@ func makePythonSpec(name string) *core.Spec {
}
func init() {
core.Register(makePythonSpec("python"))
core.Register(makePythonSpec("python3"))
core.Register(makePythonSpec("py"))
spec.Register(makePythonSpec("python"))
spec.Register(makePythonSpec("python3"))
spec.Register(makePythonSpec("py"))
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "uv",
Description: "fast python package manager",
Subcommands: []core.Subcommand{
{Name: "add", Description: "add dependency", Options: []core.Option{
Subcommands: []spec.Subcommand{
{Name: "add", Description: "add dependency", Options: []spec.Option{
{Name: "--dev", Description: "dev dependency"},
{Name: "--optional", Description: "optional dependency"},
{Name: "-e", Description: "editable install"},
{Name: "--index-url", Description: "custom index"},
}},
{Name: "remove", Description: "remove dependency", Generator: pipPackageGenerator},
{Name: "sync", Description: "sync environment", Options: []core.Option{
{Name: "sync", Description: "sync environment", Options: []spec.Option{
{Name: "--frozen", Description: "no lockfile update"},
{Name: "--dev", Description: "include dev deps"},
}},
{Name: "run", Description: "run command in env", Generator: core.FileGenerator(".py")},
{Name: "pip", Description: "pip interface", Subcommands: []core.Subcommand{
{Name: "run", Description: "run command in env", Generator: spec.FileGenerator(".py")},
{Name: "pip", Description: "pip interface", Subcommands: []spec.Subcommand{
{Name: "install", Description: "install packages"},
{Name: "uninstall", Description: "uninstall packages", Generator: pipPackageGenerator},
{Name: "list", Description: "list packages"},
@@ -51,7 +51,7 @@ func init() {
{Name: "show", Description: "show package", Generator: pipPackageGenerator},
{Name: "compile", Description: "compile requirements"},
}},
{Name: "venv", Description: "create virtual env", Generator: core.FileGenerator("/"), Options: []core.Option{
{Name: "venv", Description: "create virtual env", Generator: spec.FileGenerator("/"), Options: []spec.Option{
{Name: "--python", Description: "python version"},
{Name: "--seed", Description: "install seed packages"},
}},
@@ -60,13 +60,13 @@ func init() {
{Name: "publish", Description: "publish to pypi"},
{Name: "lock", Description: "update lockfile"},
{Name: "tree", Description: "show dependency tree"},
{Name: "tool", Description: "manage tools", Subcommands: []core.Subcommand{
{Name: "tool", Description: "manage tools", Subcommands: []spec.Subcommand{
{Name: "install", Description: "install tool"},
{Name: "run", Description: "run tool"},
{Name: "list", Description: "list tools"},
{Name: "uninstall", Description: "uninstall tool"},
}},
{Name: "python", Description: "manage python versions", Subcommands: []core.Subcommand{
{Name: "python", Description: "manage python versions", Subcommands: []spec.Subcommand{
{Name: "install", Description: "install python"},
{Name: "list", Description: "list versions"},
{Name: "find", Description: "find python"},
@@ -75,18 +75,18 @@ func init() {
},
})
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "poetry",
Description: "python dependency manager",
Subcommands: []core.Subcommand{
{Name: "add", Description: "add dependency", Options: []core.Option{
Subcommands: []spec.Subcommand{
{Name: "add", Description: "add dependency", Options: []spec.Option{
{Name: "--dev", Description: "dev dependency"},
{Name: "--group", Description: "dependency group"},
}},
{Name: "remove", Description: "remove dependency", Generator: pipPackageGenerator},
{Name: "install", Description: "install dependencies"},
{Name: "update", Description: "update dependencies"},
{Name: "run", Description: "run in env", Generator: core.FileGenerator(".py")},
{Name: "run", Description: "run in env", Generator: spec.FileGenerator(".py")},
{Name: "shell", Description: "activate virtual env"},
{Name: "build", Description: "build package"},
{Name: "publish", Description: "publish to pypi"},
@@ -94,7 +94,7 @@ func init() {
{Name: "check", Description: "check pyproject.toml"},
{Name: "init", Description: "init new project"},
{Name: "new", Description: "create new project"},
{Name: "env", Description: "manage envs", Subcommands: []core.Subcommand{
{Name: "env", Description: "manage envs", Subcommands: []spec.Subcommand{
{Name: "info", Description: "show env info"},
{Name: "list", Description: "list envs"},
{Name: "use", Description: "switch python"},
+4 -4
View File
@@ -1,17 +1,17 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "ruff",
Description: "Enable verbose logging",
Subcommands: []core.Subcommand{
Subcommands: []spec.Subcommand{
{Name: "graph", Description: "Generate a map of Python file dependencies or dependents"},
},
Options: []core.Option{
Options: []spec.Option{
{Name: "-v", Description: "Enable verbose logging"},
{Name: "-q", Description: "Print diagnostics, but nothing else"},
{Name: "-s", Description: "Path to the `pyproject.toml` or `ruff.toml` file to use for configuration"},
+4 -4
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "sqlfluff",
Description: "A dialect-flexible and configurable SQL linter",
Subcommands: []core.Subcommand{
Subcommands: []spec.Subcommand{
{Name: "lint", Description: "Lint SQL files via passing a list of files or using stdin"},
{Name: "templater", Description: "Name of templater to use, eg. raw"},
{Name: "dialect", Description: "Name of dialect, eg. ANSI"},
@@ -20,7 +20,7 @@ func init() {
{Name: "version", Description: "Show the version of sqlfluff"},
{Name: "rules", Description: "Show the current rules in use"},
},
Options: []core.Option{
Options: []spec.Option{
{Name: "--version", Description: "Show the version and exit"},
{Name: "--help", Description: "Show help for sqlfluff"},
{Name: "--nocolor", Description: "No color - output will be without ANSI color codes"},
+4 -4
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "sqlmesh",
Description: "SQLMesh command line tool",
Subcommands: []core.Subcommand{
Subcommands: []spec.Subcommand{
{Name: "init", Description: "Create a new SQLMesh repository"},
{Name: "render", Description: "Render a model's query, optionally expanding referenced models"},
{Name: "evaluate", Description: "Evaluate a model and return a dataframe with a default limit of 1000"},
@@ -26,7 +26,7 @@ func init() {
{Name: "rollback", Description: "Rollback SQLMesh to the previous migration"},
{Name: "create_external_models", Description: "Create a schema file containing external model schemas"},
},
Options: []core.Option{
Options: []spec.Option{
{Name: "--paths", Description: "Paths to SQLMesh project files"},
{Name: "--config", Description: "Path to config file"},
{Name: "--gateway", Description: "The name of the gateway"},
+4 -4
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "streamlit",
Description: "Streamlit",
Subcommands: []core.Subcommand{
Subcommands: []spec.Subcommand{
{Name: "activate", Description: "Activate Streamlit by entering your email"},
{Name: "cache", Description: "Manage the Streamlit cache"},
{Name: "clear", Description: "Clear st.cache, st.memo, and st.singleton caches"},
@@ -21,7 +21,7 @@ func init() {
{Name: "file", Description: "The Python script to run"},
{Name: "version", Description: "Print Streamlit's version number"},
},
Options: []core.Option{
Options: []spec.Option{
{Name: "--log_level", Description: "Set the log level"},
{Name: "--help", Description: "Show a help message and exit"},
{Name: "--version", Description: "Show the version and exit"},
+3 -3
View File
@@ -1,14 +1,14 @@
package python
import (
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "youtube-dl",
Description: "Clipboard",
Options: []core.Option{
Options: []spec.Option{
{Name: "--help", Description: "Print the help text and exit"},
{Name: "--version", Description: "Print program version and exit"},
{Name: "-U", Description: "Display the current browser identification"},