refactor: Declared commands with named fields instead of positional.

This commit is contained in:
2026-07-01 14:01:22 -04:00
parent 209ec89add
commit aae1495d59
+62 -65
View File
@@ -68,82 +68,79 @@ GLOBAL_FLAGS: bit_set[Flag_Type] = {.Help, .Config_File, .Color}
COMMANDS := []CommandInfo {
{
"init",
"envr init",
"Set up envr",
`The init command generates your initial config and saves it to
name = "init",
usage = "envr init",
short = "Set up envr",
long = `The init command generates your initial config and saves it to
~/.envr/config in JSON format.\n\nDuring setup, you will be prompted to select one or more ssh keys with which to
encrypt your databse. **Make 100% sure** that you have **a remote copy** of this
key somewhere, otherwise your data could be lost forever.`,
{},
GLOBAL_FLAGS + {.Force},
{},
},
{"scan", "envr scan", "Find and select .env files for backup", "", {}, GLOBAL_FLAGS, {}},
{
"sync",
"envr sync",
"Update or restore your env backups",
"",
{},
GLOBAL_FLAGS + {.Output},
{},
flags = GLOBAL_FLAGS + {.Force},
},
{
"backup",
"envr backup <path>",
"Import a .env file into envr",
"",
{"add"},
GLOBAL_FLAGS,
{{name = "path", completion = "untracked-paths"}},
name = "scan",
usage = "envr scan",
short = "Find and select .env files for backup",
flags = GLOBAL_FLAGS,
},
{
"restore",
"envr restore <path>",
"Restore a .env file from the database",
"",
{},
GLOBAL_FLAGS,
{{name = "path", completion = "tracked-paths"}},
},
{"list", "envr list", "View your tracked files", "", {}, GLOBAL_FLAGS + {.Output}, {}},
{
"remove",
"envr remove <path>",
"Remove a .env file from your database",
"",
{},
GLOBAL_FLAGS,
{{name = "path", completion = "tracked-paths"}},
name = "sync",
usage = "envr sync",
short = "Update or restore your env backups",
flags = GLOBAL_FLAGS + {.Output},
},
{
"check",
"envr check [path]",
"Check if files are backed up",
"",
{},
GLOBAL_FLAGS,
{{name = "path", optional = true}},
},
{"version", "envr version", "Show envr's version", "", {}, {.Help}, {}},
{
"edit-config",
"envr edit-config",
"Edit your config with your default editor",
"",
{},
GLOBAL_FLAGS,
{},
name = "backup",
usage = "envr backup <path>",
short = "Import a .env file into envr",
aliases = {"add"},
flags = GLOBAL_FLAGS,
args = {{name = "path", completion = "untracked-paths"}},
},
{
"nushell-completion",
"envr nushell-completion",
"Generate custom completions for nushell",
"",
{},
{.Help},
{},
name = "restore",
usage = "envr restore <path>",
short = "Restore a .env file from the database",
flags = GLOBAL_FLAGS,
args = {{name = "path", completion = "tracked-paths"}},
},
{
name = "list",
usage = "envr list",
short = "View your tracked files",
flags = GLOBAL_FLAGS + {.Output},
},
{
name = "remove",
usage = "envr remove <path>",
short = "Remove a .env file from your database",
flags = GLOBAL_FLAGS,
args = {{name = "path", completion = "tracked-paths"}},
},
{
name = "check",
usage = "envr check [path]",
short = "Check if files are backed up",
flags = GLOBAL_FLAGS,
args = {{name = "path", optional = true}},
},
{
name = "version",
usage = "envr version",
short = "Show envr's version",
flags = {.Help},
},
{
name = "edit-config",
usage = "envr edit-config",
short = "Edit your config with your default editor",
flags = GLOBAL_FLAGS,
},
{
name = "nushell-completion",
usage = "envr nushell-completion",
short = "Generate custom completions for nushell",
flags = {.Help},
},
}