Gathering detailed insights and metrics for @fig/complete-commander
Gathering detailed insights and metrics for @fig/complete-commander
Gathering detailed insights and metrics for @fig/complete-commander
Gathering detailed insights and metrics for @fig/complete-commander
npm install @fig/complete-commander
Typescript
Module System
Node Version
NPM Version
88.7
Supply Chain
96.7
Quality
82
Maintenance
100
Vulnerability
99.6
License
TypeScript (91.75%)
JavaScript (2.81%)
Python (2.81%)
Go (2.56%)
Shell (0.05%)
Makefile (0.02%)
Total Downloads
6,354,142
Last Day
4,766
Last Week
82,333
Last Month
594,489
Last Year
5,846,214
46 Stars
534 Commits
30 Forks
5 Watching
35 Branches
16 Contributors
Latest Version
3.2.0
Package Id
@fig/complete-commander@3.2.0
Unpacked Size
11.64 kB
Size
4.35 kB
File Count
5
NPM Version
10.5.0
Node Version
20.12.2
Publised On
06 Jun 2024
Cumulative downloads
Total Downloads
Last day
-25%
4,766
Compared to previous day
Last week
-49.4%
82,333
Compared to previous week
Last month
-10.2%
594,489
Compared to previous month
Last year
1,051.9%
5,846,214
Compared to previous year
1
1
6
A tool to speed up the workflow of converting Commander commands to Fig completion spec files.
1generateCompletionSpec(command[, options]): string
Generate a completion spec from the provided command and return it a string.
command
: a commander.Command
objectoptions
: an object containing the following optional properties:
figSpecCommandName
: specify the name of the command used to generate the fig spec (see). It defaults to 'generate-fig-spec'
1addCompletionSpecCommand(command): void
Add a new Subcommand to the provided command that will print a spec generated when invoked through $CLI generate-fig-spec
.
command
: a commander.Command
objectUsing this library is as simple as calling a function. The snippet of code below generates a new spec each time the executable file is run.
1import { program } from 'commander' 2import { generateCompletionSpec } from '@fig/complete-commander' 3 4program 5 .name('babel') 6 .description('The compiler for writing next generation JavaScript') 7 .version('7.16.0') 8 .argument('<file>', 'file to compile') 9 10// Do not generate if production env 11if (process.env.NODE_ENV === 'development') { 12 const spec = generateCompletionSpec(program) // write the generated spec to a file or print it to the console 13}
You can also provide a custom command that generates a spec file when called. For example, the program below generates the Fig spec when eslint generate-fig-spec
is run from a Terminal.
1import { program } from 'commander' 2import { addCompletionSpecCommand } from '@fig/complete-commander' 3 4program 5 .name('eslint') 6 .description('Find and fix problems in your JavaScript code') 7 .version('8.0.0') 8 .argument('<file>', 'file to lint') 9 10if (process.env.NODE_ENV === 'development') { 11 addCompletionSpecCommand(program) 12} 13program.parse()
NOTE: the command can be called whatever you want, but if you specify a name different from
'generate-fig-spec'
you should set thefigSpecCommandName
option.
generateCompletionSpec
When creating a custom command to generate a Fig spec whose name is different from 'generateCompletionSpec'
you want to avoid including it in the generated file. This option helps you do that.
1program 2 .name('eslint') 3 .description('Find and fix problems in your JavaScript code') 4 .version('8.0.0') 5 .argument('<file>', 'file to lint') 6 7if (process.env.NODE_ENV === 'development') { 8 program 9 .command('createSpec') // this command will not be included in the generated spec 10 .description('Generate a fig spec') 11 .action(() => { 12 generateCompletionSpec(program, { figSpecCommandName: 'createSpec' }) 13 }) 14} 15program.parse()
p.s. this tool has been written for commander@8
, but should work in the most of the previous versions too.
This integration was built by Federico Ciardi. Please see his repo for previous git history: https://github.com/fedeci/commander-to-fig.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
11 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 9
Reason
8 existing vulnerabilities detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/1 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More