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:
+22
-22
@@ -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"},
|
||||
|
||||
Reference in New Issue
Block a user