Simple command line interface template for creating internal CLI's π»
βββ cmd
βΒ Β βββ {cmd_name}
βΒ Β βββ main.go
βββ {cmd_name}.go
βββ {cmd_sub_name}.go
βββ ...
βββ go.mod
βββ go.sum
βββ LICENSE
βββ Makefile
βββ pkg
βΒ Β βββ config
βΒ Β βΒ Β βββ config.go
βΒ Β βββ dir
βΒ Β βΒ Β βββ dir.go
βΒ Β βββ editor
βΒ Β βΒ Β βββ editor.go
βΒ Β βββ fs
βΒ Β βΒ Β βββ fs.go
βΒ Β βββ shell
βΒ Β βββ shell.go
βββ README.md
The layout consists on the pkg
directory which has all the dependencies that I
need for creating custom CLI's and the cmd
directory which just executes the
cmd
package which is all the {cmd_name}.go, {cmd_sub_name}.go files...
The config pkg works as a getter and setter of json, where you can
config.Query()
and config.Set()
on a specific config path.
conf := c.Conf{
Id: "{cmd_name}",
Dir: "{configs_path}",
File: "config.json",
}