cli

its very very early alpha demo
UU
Unknown User812d ago
C
ccjmk812d 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
UU
Unknown User812d ago
C
ccjmk812d 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) *
UU
Unknown User812d ago
C
ccjmk812d ago
yeah, as I mentioned this is 0.0.1-preprealpha, but I was considering maybe foundry-cli or CLIpper
UU
Unknown User812d ago
C
ccjmk812d 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 😆
UU
Unknown User812d ago
C
ccjmk812d 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
UU
Unknown User812d ago
C
ccjmk811d 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 😆
UU
Unknown User810d ago
Want results from more Discord servers?
Add your server
More Posts
Monarch APIAlright, adventurous ones: I have a Beta version of Monarch with the new components API! Manifest: compacted chat cardsModules create problems to solve problems... Today's problem: "When I roll an attack, it eats the whdragdrop shenneneginsRight now, a user can drag a spell onto their character sheet. I store that in a 'spell' array and leffect mini modulesI've gotten to the point where I'm confident in releasing a slurry of tiny no-config Active Effect rdamage application hooksNew 5e Hook ideas, gimme yer thoughts: `Hooks.call('Actor5e.preDamageApplied')` args: `damageAmounthook conventionsRegarding hooks, is the convention that _all_ `pre...` hooks are executed on the machine that initiaexpand arraysIs there a way to `expandObject` except for an Array?edit-owned-item-effectI've made an abomination. This hacks its way past the limitations surrounding editing effects on ownItem Pile feedbackSimple is king!effects to chat@badideasbureau is the `temporary` flag you look for in Effects to Chat a convention from somewhere 5e AEsI've been messing pretty heavily with some Active Effect assumptions and mechanisms in 5e. This is mhero creator ui feedbackI'm trying to refactor the abilities' tab on the hero creation room to accomodate Race ASIs, but I deffect mechanic searchingI need someone to check me on a null hypothesis I'm making. > There are no abilities in 5e RAW whicDialog shennaneginsTIL the button callbacks for `Dialog.prompt` and `Dialog.confirm` can be asynchronous. ```js const Advancement Hooks@kandashi @ccjmk and anyone else who is currently working on modules that would interact with the AdAPI doc topicsGive me some ideas for what areas of the foundry core API would benefit from a wiki documentation paDiscord Permission IssueOh, I think you also need a Typescript roleDevelopment-APIA new section of the Wiki was created today: `development/api` This section is dedicated to documentitem to actors scriptI have this macro for updating actors in a compendium with spells from a compendium of spells (i.e. Primary and Embedded UpdatesTIL how to update embedded documents at the same time as parent documents. ``` game.actors.getName(