slapdash-commands
v0.0.5
Published
π» Write your own commands for Slapdash.
Downloads
2
Readme
π» Slapdash Commands
Slapdash brings all your apps together in one place to give you new superpowers.
This package makes writing your own Slapdash commands fun and easy.
Highlights
- Actions
- Configs
- Move actions
- Tokens
- Views (
list
,form
, andmasonry
) - Response builder
- Autocomplete
- Arguments
- Zero dependencies and lightweight (22 kB)
- Well-documented
Getting Started
Requirements
Slapdash
To test and run your commands, you should have Slapdash installed.
Installation
Install and use this package as easy as running this command.
npm install slapdash-commands
Usage
This is our recommended directory structure.
.
βββ my-command/
βββ src/
β βββ pages/
β β βββ first.ts
β β βββ second.ts
β β βββ third.ts
β βββ args.ts
β βββ command.ts
βββ package.json
βββ tsconfig.json
pages
Each move action is called a page here. A move action changes the location of the Command Bar. We recommend you follow this structure to make your code understandable and testable.
args.ts
This is optional, but creating an interface of the command's arguments helps you with linting and auto-completion.
interface Arguments {
firstArg?: string;
secondArg?: string;
// ...
}
command.ts
Start writing your own command from here.
slapdash((args: Arguments) => {
// Use the pages, from last to first
if (args.secondArg !== undefined) {
return thirdPage(args.secondArg);
} else if (args.firstArg !== undefined) {
return secondPage(args.firstArg);
}
return firstPage();
});
For more examples, please refer to the Documentation.
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
Donate π
You can support this project and transfer BTC to this address.
bc1qgwar7xmpsed3qaq0fvf08qxmyvd40t8t9tnaf4
License
Distributed under the MIT License. See MIT license for more information.