cli

its very very early alpha demo
13 Replies
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ccjmk
ccjmk•3y ago
(putting this here now that you started a thread) and adding new commands is rather easy:
cli.register({
name: "sum", // string
scheme: "sum $a $b", // string
args: [
{
name: "a", // string, name needs to match one of the $ values on the scheme
type: "number", // types are gated, this can be "string" | "number"(can have comma) | "integer" | "quoted-string" (this one NEEDS quotes and can have spaces inside)
}, {
name: "b",
type: "number",
}
],
handler: ({a, b}) => { // param names need to match the names or the args[]
ui.notifications?.info("the sum is "+(a+b));
}
})
cli.register({
name: "sum", // string
scheme: "sum $a $b", // string
args: [
{
name: "a", // string, name needs to match one of the $ values on the scheme
type: "number", // types are gated, this can be "string" | "number"(can have comma) | "integer" | "quoted-string" (this one NEEDS quotes and can have spaces inside)
}, {
name: "b",
type: "number",
}
],
handler: ({a, b}) => { // param names need to match the names or the args[]
ui.notifications?.info("the sum is "+(a+b));
}
})
thanks btw! It was a nice lovely thursday project hahah there's a hell lot of open gaps everywhere though
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ccjmk
ccjmk•3y ago
yup, I am actually still pondering if your idea is not better (I mean, it is, but the drawback is more dev time and increased complexity :P) *
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ccjmk
ccjmk•3y ago
yeah, as I mentioned this is 0.0.1-preprealpha, but I was considering maybe foundry-cli or CLIpper
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ccjmk
ccjmk•3y ago
well absolutely, an actually CLI is a lot more complex, ... a lot more what you proposed honestly! I kinda like "CLIpper", has a smooth tone to it 😆
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ccjmk
ccjmk•3y ago
aside from the actual extra effort in getting a proper lexer-parser working on this, the one thing that really drove me to this approach was how easy it was to add commands though I can't even imagine how I could provide a palatable api for that
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ccjmk
ccjmk•3y ago
eh there's some particularities, like rn command string and command "string" are two different commands, where that should be able to handled with some semantic analysis post-AST buildup but honestly, I barely touched these subjects in college and never after seen them until Yesterday, so im a little lost in the woods xD It sure might be a cool exploratory/remembrance journey eventually (also, something like the example I did could probably me solveable too with just a little more complex regex) @errational got a new module name*! "Commander"! what say you? it really irked me that yeah, this is no CLI, its not even giving text feedback, its a glorified command launcher.. ergo... a commander 👉 👉 it's also a short, easy-to-remember name, and at least vaguely related to all this "rpg nonesense" world we live 😆
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View