@ -55,3 +55,13 @@ in addition to this new interface, i want to change how commands are tracked. th
- sqlite3. a little overkill.
- json file. a little underkill.
what am I doing. should there even be a system like this? what about just letting anyone add anything? i think we're big enough that we shouldn't go moderation less and i can also help guarantee things are runnable and maintainable, this way.
i have a gut feeling that involving SQL here is bad. I like the flat file approach for requesting that something be added to core; those are easy to review and tweak, but after that, what to do? right now the town launcher consumes a directory of flat files to create the command hierarchy. i could keep that code the same. the ultimate issue is having to have the corresponding executable. right now, that might be a bash wrapper that i write; it could be a compiled executable; it could be a script someone else writes; as of now, it doesn't seem like it can be a symlink which i think is good.
several of the wrapper scripts are just calling the executable path and passing args; i think i should just do that from go.
so we'll have: /town/requests/contrib to store requests to add. once added, they will go to /town/commands/contrib as a yaml file with no need for a corresponding executable.
competing with this, i want a `town wild` command that can call any executable in a world writeable dir. because it's funny
Message:"what category should this command be filed under?",
Message:"what category best describes this command?",
Options:categories,
},&choice);err!=nil{
returnerr
}
category=categories[choice]
fmt.Printf("DBG %#v\n",category)
iferr:=survey.AskOne(&survey.Input{
Message:"What's a one line description of this command?",
},&shortDescription);err!=nil{
Message:"in one brief sentence, what does this command do?",
},&shortDesc);err!=nil{
returnerr
}
iferr:=survey.AskOne(&survey.Editor{
Message:"Write a long description for this command. Try to include examples. If the short description is enough, you can just leave it blank though. Really it's whatever you want. I donno"},&longDescription);err!=nil{
Message:"yr editor is gonna open. in there please write a long description for this command. not like, novel long, but maybe a sentence or two and some examples."},&longDesc);err!=nil{
returnnil
}
// TODO create pending row
// TODO email me
// TODO print confirmation
// TODO be able to set a maintainer other than caller. this might only be if an admin.
// TODO would be fun if it was a Select using a user list -- extract that from stats cmd
c:=contrib{
CmdName:cmdName,
Category:category,
ShortDesc:shortDesc,
LongDesc:longDesc,
ExecPath:opts.ExecPath,
// for later validation against file owner
Maintainer:u.Name,
MaintainerUID:u.Uid,
}
bs,err:=yaml.Marshal(c)
iferr!=nil{
returnfmt.Errorf("failed to serialize contrib: %w",err)