add admin bucket back
parent
66d91bd1ba
commit
8115522703
10
main.go
10
main.go
|
@ -13,13 +13,18 @@ import (
|
|||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
const binroot = "/town/launcher"
|
||||
const binroot = "/town/commands"
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "town",
|
||||
Short: "Run commands unique to tilde.town",
|
||||
}
|
||||
|
||||
var adminCmd = &cobra.Command{
|
||||
Use: "admin",
|
||||
Short: "Run administrative commands",
|
||||
}
|
||||
|
||||
func isAdmin() (bool, error) {
|
||||
u, err := user.Current()
|
||||
if err != nil {
|
||||
|
@ -148,7 +153,8 @@ func cli() int {
|
|||
}
|
||||
|
||||
if admin {
|
||||
err = parseCommands(rootCmd, "admin")
|
||||
rootCmd.AddCommand(adminCmd)
|
||||
err = parseCommands(adminCmd, "admin")
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "failed to parse admin commands: %s", err)
|
||||
return 1
|
||||
|
|
Reference in New Issue