Installations
npm install @fig/complete-commander
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
20.12.2
NPM Version
10.5.0
Score
88.7
Supply Chain
96.7
Quality
82
Maintenance
100
Vulnerability
99.6
License
Releases
Unable to fetch releases
Contributors
Languages
TypeScript (91.75%)
JavaScript (2.81%)
Python (2.81%)
Go (2.56%)
Shell (0.05%)
Makefile (0.02%)
Developer
withfig
Download Statistics
Total Downloads
6,380,889
Last Day
11,611
Last Week
73,483
Last Month
611,567
Last Year
5,869,415
GitHub Statistics
46 Stars
534 Commits
30 Forks
5 Watching
35 Branches
16 Contributors
Bundle Size
79.55 kB
Minified
26.37 kB
Minified + Gzipped
Package Meta Information
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
Total Downloads
Cumulative downloads
Total Downloads
6,380,889
Last day
-17.4%
11,611
Compared to previous day
Last week
-44%
73,483
Compared to previous week
Last month
-1.8%
611,567
Compared to previous month
Last year
1,048.4%
5,869,415
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Peer Dependencies
1
Dev Dependencies
6
Commander integration
A tool to speed up the workflow of converting Commander commands to Fig completion spec files.
Docs
1generateCompletionSpec(command[, options]): string
Generate a completion spec from the provided command and return it a string.
command
: acommander.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
: acommander.Command
object
Usage
Using 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}
Custom command
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.
Options for generateCompletionSpec
Specify the fig command name
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.
Contributors
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
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
7 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Reason
8 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-64vr-g452-qvp3
- Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx
Reason
Found 0/1 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/lint.yml:1
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Warn: no topLevel permission defined: .github/workflows/update-autocomplete-tools-spec.yaml:1
- Warn: no topLevel permission defined: .github/workflows/update-create-completion-spec-spec.yaml:1
- Warn: no topLevel permission defined: .github/workflows/update-docs.yaml:1
- Warn: no topLevel permission defined: .github/workflows/update-publish-spec-to-team-spec.yaml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/lint.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/lint.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/lint.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/lint.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/test.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/test.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/update-autocomplete-tools-spec.yaml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-autocomplete-tools-spec.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/update-autocomplete-tools-spec.yaml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-autocomplete-tools-spec.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/update-autocomplete-tools-spec.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-autocomplete-tools-spec.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/update-autocomplete-tools-spec.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-autocomplete-tools-spec.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/update-create-completion-spec-spec.yaml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-create-completion-spec-spec.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/update-create-completion-spec-spec.yaml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-create-completion-spec-spec.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/update-create-completion-spec-spec.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-create-completion-spec-spec.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/update-create-completion-spec-spec.yaml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-create-completion-spec-spec.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/update-docs.yaml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-docs.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/update-publish-spec-to-team-spec.yaml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-publish-spec-to-team-spec.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/update-publish-spec-to-team-spec.yaml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-publish-spec-to-team-spec.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/update-publish-spec-to-team-spec.yaml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-publish-spec-to-team-spec.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/update-publish-spec-to-team-spec.yaml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-publish-spec-to-team-spec.yaml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/update-publish-spec-to-team-spec.yaml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/withfig/autocomplete-tools/update-publish-spec-to-team-spec.yaml/main?enable=pin
- Info: 0 out of 10 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 10 third-party GitHubAction dependencies pinned
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 30 are checked with a SAST tool
Score
3.2
/10
Last Scanned on 2024-12-30
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