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
+9 -9
View File
@@ -4,11 +4,11 @@ import (
"os"
"strings"
"github.com/versenilvis/iris/commands/core"
"github.com/versenilvis/iris/spec"
)
func envVarGenerator(tokens []string, _ string, _ string) []core.Suggestion {
var results []core.Suggestion
func envVarGenerator(tokens []string, _ string, _ string) []spec.Suggestion {
var results []spec.Suggestion
for _, env := range os.Environ() {
parts := strings.SplitN(env, "=", 2)
name := parts[0]
@@ -20,36 +20,36 @@ func envVarGenerator(tokens []string, _ string, _ string) []core.Suggestion {
val = val[:57] + "..."
}
}
results = append(results, core.Suggestion{Cmd: name, Desc: val})
results = append(results, spec.Suggestion{Cmd: name, Desc: val})
}
return results
}
func init() {
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "export",
Description: "set environment variable",
Generator: envVarGenerator,
})
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "env",
Description: "print environment",
Generator: envVarGenerator,
Options: []core.Option{
Options: []spec.Option{
{Name: "-i", Description: "start with empty env"},
{Name: "-u", Description: "unset variable"},
{Name: "-0", Description: "null delimited"},
},
})
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "printenv",
Description: "print environment variables",
Generator: envVarGenerator,
})
core.Register(&core.Spec{
spec.Register(&spec.Spec{
Name: "unset",
Description: "unset variable",
Generator: envVarGenerator,