Skip to content

Commit

Permalink
chore: 🤖 Add Help subcommand for storage subcommands (#46)
Browse files Browse the repository at this point in the history
## Why?

The Storage subcommands should display detailed information to utilize
any flags and options.

## How?

-  Declare each subcommand to include the help command

## Tickets?

-
[PLAT-1520](https://linear.app/fleekxyz/issue/PLAT-1520/add-help-to-storage-subcommand)

## Contribution checklist?

- [x] The commit messages are detailed
- [x] The `build` command runs locally
- [ ] Assets or static content are linked and stored in the project
- [ ] You have manually tested
- [ ] You have provided tests

## Security checklist?

- [ ] Sensitive data has been identified and is being protected properly
- [ ] Injection has been prevented (parameterized queries, no eval or
system calls)

## Preview?
  • Loading branch information
heldrida authored Sep 19, 2024
1 parent abcb8e9 commit 1044fa7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/commands/storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export default (program: Command) => {
cmd
.command('list')
.description(t('storageListDescription'))
.action(() => listStorageActionHandler());
.action(() => listStorageActionHandler())
.addHelpCommand();

const getStorage = cmd
.command('get')
Expand All @@ -24,7 +25,8 @@ export default (program: Command) => {
.option(
'-n, --name <filenameWithExtension>',
t('storageNameOption', { action: t('get') }),
);
)
.addHelpCommand();

getStorage.action((options: { cid?: string; name?: string }) => {
if ((!options.name && !options.cid) || (options.name && options.cid)) {
Expand All @@ -51,7 +53,8 @@ export default (program: Command) => {
.option(
'-n, --name <filenameWithExtension>',
t('storageNameOption', { action: t('delete') }),
);
)
.addHelpCommand();

deleteStorage.action((options: { cid?: string; name?: string }) => {
if ((!options.name && !options.cid) || (options.name && options.cid)) {
Expand All @@ -75,5 +78,6 @@ export default (program: Command) => {
.command('add')
.description(t('storageAddDescription'))
.argument('<path>', t('ipfsAddPathDescription'))
.action((path: string) => addStorageActionHandler({ path }));
.action((path: string) => addStorageActionHandler({ path }))
.addHelpCommand();
};

0 comments on commit 1044fa7

Please sign in to comment.