Skip to content

Commit

Permalink
Update sub-commands to run in proc. Update client_cli snapshots.
Browse files Browse the repository at this point in the history
  • Loading branch information
phalestrivir committed May 7, 2024
1 parent fc7637d commit 0553f77
Show file tree
Hide file tree
Showing 237 changed files with 9,759 additions and 9,231 deletions.
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;
}
88 changes: 45 additions & 43 deletions src/cli/_template/something-else-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,55 @@ import { Option } from 'commander';
import { getTokens } from '../../ops/AuthenticateOps';
import { FrodoCommand } from '../FrodoCommand';

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

program
.description('Export something else.')
.addOption(
new Option(
'-i, --else-id <else-id>',
'[Else] id. If specified, -a and -A are ignored.'
program
.description('Export something else.')
.addOption(
new Option(
'-i, --else-id <else-id>',
'[Else] id. If specified, -a and -A are ignored.'
)
)
)
.addOption(new Option('-f, --file <file>', 'Name of the export file.'))
.addOption(
new Option(
'-a, --all',
'Export all [else] to a single file. Ignored with -i.'
.addOption(new Option('-f, --file <file>', 'Name of the export file.'))
.addOption(
new Option(
'-a, --all',
'Export all [else] to a single file. Ignored with -i.'
)
)
)
.addOption(
new Option(
'-A, --all-separate',
'Export all [else] to separate files (*.[else].json) in the current directory. Ignored with -i or -a.'
.addOption(
new Option(
'-A, --all-separate',
'Export all [else] to separate files (*.[else].json) in the current directory. Ignored with -i or -a.'
)
)
)
.addOption(
new Option(
'-N, --no-metadata',
'Does not include metadata in the export file.'
.addOption(
new Option(
'-N, --no-metadata',
'Does not include metadata in the export file.'
)
)
)
.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;
}
Loading

0 comments on commit 0553f77

Please sign in to comment.