add admin bucket back

master
vilmibm 2020-06-10 05:35:41 +00:00
parent 66d91bd1ba
commit 8115522703
1 changed files with 8 additions and 2 deletions

10
main.go
View File

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