Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove oclif alias support #101

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions integrations/oclif/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fig/complete-oclif",
"description": "Generate Fig completion spec from oclif",
"version": "2.0.0",
"version": "2.0.1",
"author": "Matt Schrage @mattschrage",
"bugs": "https://github.com/withfig/autocomplete-tools/issues",
"dependencies": {
Expand Down Expand Up @@ -33,7 +33,7 @@
]
},
"scripts": {
"build": "tsc",
"build": "rm -rf lib && tsc",
"postpack": "rm -f oclif.manifest.json",
"prepack": "pnpm build && oclif manifest && oclif readme",
"version": "oclif readme && git add README.md"
Expand Down
11 changes: 3 additions & 8 deletions integrations/oclif/src/commands/generate-fig-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function getFigArgs(args: Command.Arg.Cached[]): Fig.Arg[] {
figArgs.push({
name: arg.name,
...(arg.description && { description: arg.description }),
...(arg.default && { default: arg.default }),
...(arg.default && { default: `${arg.default}` }),
...(arg.options?.length && { suggestions: arg.options }),
...(arg.required === false && { isOptional: true }),
});
Expand All @@ -27,7 +27,7 @@ function getFigOptions(options: Command.Flag.Cached[]): Fig.Option[] {
args: {
description: flag.helpValue,
...(flag.options?.length && { suggestions: flag.options }),
...(flag.default && { default: flag.default }),
...(flag.default && { default: `${flag.default}` }),
},
}),
...(flag.required === true && { isRequired: true }),
Expand All @@ -52,13 +52,8 @@ function getFigSubcommands(commands: Command.Loadable[]): Fig.Subcommand[] {
const options: Fig.Option[] = getFigOptions(Object.values(command.flags));
const args: Fig.Arg[] = getFigArgs(Object.values(command.args));

const name =
command.aliases.length > 0
? Array.from(new Set([command.id, ...command.aliases]))
: command.id;

subcommands.push({
name,
name: command.id,
...(command.description && { description: command.description }),
...(options.length && { options }),
...(args.length && { args }),
Expand Down
Loading