Skip to content

Commit

Permalink
Merge pull request #389 from rockcarver/pr/388
Browse files Browse the repository at this point in the history
Pr/388
  • Loading branch information
vscheuber committed May 8, 2024
2 parents cd34901 + 1f743bb commit 31db484
Show file tree
Hide file tree
Showing 240 changed files with 9,778 additions and 9,239 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
]
},
"dependencies": {
"@rockcarver/frodo-lib": "2.0.0-79",
"@rockcarver/frodo-lib": "2.0.0-80",
"chokidar": "^3.5.3",
"cli-progress": "^3.11.2",
"cli-table3": "^0.6.3",
Expand Down
13 changes: 12 additions & 1 deletion src/cli/FrodoCommand.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { frodo, state } from '@rockcarver/frodo-lib';
import { Argument, Command, Option } from 'commander';
import { Argument, Command, Help, Option } from 'commander';
import fs from 'fs';

import * as globalConfig from '../storage/StaticStorage';
Expand Down Expand Up @@ -202,6 +202,17 @@ export class FrodoStubCommand extends Command {
cleanupProgressIndicators();
});
}

createHelp() {
return Object.assign(new FrodoStubHelp(), this.configureHelp());
}
}

class FrodoStubHelp extends Help {
subcommandTerm(cmd) {
return cmd._name +

Check warning on line 213 in src/cli/FrodoCommand.ts

View workflow job for this annotation

GitHub Actions / Build

Delete `⏎·······`
(cmd._aliases[0] ? '|' + cmd._aliases[0] : '');
}
}

/**
Expand Down
72 changes: 37 additions & 35 deletions src/cli/_template/something-delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,45 @@ import { Option } from 'commander';
import { getTokens } from '../../ops/AuthenticateOps';
import { FrodoCommand } from '../FrodoCommand';

const program = new FrodoCommand('frodo something delete');
export default function setup() {
const program = new FrodoCommand('frodo something delete');

program
.description('Delete something.')
.addOption(
new Option(
'-i, --something-id <something-id>',
'[Something] id. If specified, -a and -A are ignored.'
program
.description('Delete something.')
.addOption(
new Option(
'-i, --something-id <something-id>',
'[Something] id. If specified, -a and -A are ignored.'
)
)
)
.addOption(
new Option('-a, --all', 'Delete all [somethings]. Ignored with -i.')
)
.addOption(
new Option(
'--no-deep',
'No deep delete. This leaves orphaned configuration artifacts behind.'
.addOption(
new Option('-a, --all', 'Delete all [somethings]. Ignored with -i.')
)
)
.action(
// implement command logic inside action handler
async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
realm,
user,
password,
options,
command
);
if (await getTokens()) {
// code goes here
} else {
process.exitCode = 1;
.addOption(
new Option(
'--no-deep',
'No deep delete. This leaves orphaned configuration artifacts behind.'
)
)
.action(
// implement command logic inside action handler
async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
realm,
user,
password,
options,
command
);
if (await getTokens()) {
// code goes here
} else {
process.exitCode = 1;
}
}
}
// end command logic inside action handler
);
// end command logic inside action handler
);

program.parse();
return program;
}
50 changes: 27 additions & 23 deletions src/cli/_template/something-describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,33 @@ import { Option } from 'commander';
import { getTokens } from '../../ops/AuthenticateOps';
import { FrodoCommand } from '../FrodoCommand';

const program = new FrodoCommand('frodo something describe');
export default function setup() {
const program = new FrodoCommand('frodo something describe');

program
.description('Describe something.')
.addOption(new Option('-i, --something-id <something-id>', '[Something] id.'))
.action(
// implement command logic inside action handler
async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
realm,
user,
password,
options,
command
);
if (await getTokens()) {
// code goes here
} else {
process.exitCode = 1;
program
.description('Describe something.')
.addOption(
new Option('-i, --something-id <something-id>', '[Something] id.')
)
.action(
// implement command logic inside action handler
async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
realm,
user,
password,
options,
command
);
if (await getTokens()) {
// code goes here
} else {
process.exitCode = 1;
}
}
}
// end command logic inside action handler
);
// end command logic inside action handler
);

program.parse();
return program;
}
68 changes: 35 additions & 33 deletions src/cli/_template/something-else-delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,43 @@ import { Option } from 'commander';
import { getTokens } from '../../ops/AuthenticateOps';
import { FrodoCommand } from '../FrodoCommand';

const program = new FrodoCommand('frodo something else delete');
export default function setup() {
const program = new FrodoCommand('frodo something else delete');

program
.description('Delete something else.')
.addOption(
new Option(
'-i, --else-id <else-id>',
'[Else] id. If specified, -a and -A are ignored.'
program
.description('Delete something else.')
.addOption(
new Option(
'-i, --else-id <else-id>',
'[Else] id. If specified, -a and -A are ignored.'
)
)
)
.addOption(new Option('-a, --all', 'Delete all [elses]. Ignored with -i.'))
.addOption(
new Option(
'--no-deep',
'No deep delete. This leaves orphaned configuration artifacts behind.'
.addOption(new Option('-a, --all', 'Delete all [elses]. Ignored with -i.'))
.addOption(
new Option(
'--no-deep',
'No deep delete. This leaves orphaned configuration artifacts behind.'
)
)
)
.action(
// implement command logic inside action handler
async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
realm,
user,
password,
options,
command
);
if (await getTokens()) {
// code goes here
} else {
process.exitCode = 1;
.action(
// implement command logic inside action handler
async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
realm,
user,
password,
options,
command
);
if (await getTokens()) {
// code goes here
} else {
process.exitCode = 1;
}
}
}
// end command logic inside action handler
);
// end command logic inside action handler
);

program.parse();
return program;
}
48 changes: 25 additions & 23 deletions src/cli/_template/something-else-describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,31 @@ import { Option } from 'commander';
import { getTokens } from '../../ops/AuthenticateOps';
import { FrodoCommand } from '../FrodoCommand';

const program = new FrodoCommand('frodo something else describe');
export default function setup() {
const program = new FrodoCommand('frodo something else describe');

program
.description('Describe something else.')
.addOption(new Option('-i, --else-id <else-id>', '[Else] id.'))
.action(
// implement command logic inside action handler
async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
realm,
user,
password,
options,
command
);
if (await getTokens()) {
// code goes here
} else {
process.exitCode = 1;
program
.description('Describe something else.')
.addOption(new Option('-i, --else-id <else-id>', '[Else] id.'))
.action(
// implement command logic inside action handler
async (host, realm, user, password, options, command) => {
command.handleDefaultArgsAndOpts(
host,
realm,
user,
password,
options,
command
);
if (await getTokens()) {
// code goes here
} else {
process.exitCode = 1;
}
}
}
// end command logic inside action handler
);
// end command logic inside action handler
);

program.parse();
return program;
}
Loading

0 comments on commit 31db484

Please sign in to comment.