GitXplorerGitXplorer
f

commander-to-fig

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
3bfc7f67fe98fc955931f3bddc8c47d51bd36471

Update `README.md`

ffedeci committed 3 years ago
Unverified
ad9ec913fa89096051a83d6e22adb2647662c669

feat: use `@withfig/autocomplete-types` for types

ffedeci committed 3 years ago
Unverified
401149868decf6fd93c63eaa71c112c554a4dc82

feat: use `@withfig/autocomplete-tools` package for types

ffedeci committed 3 years ago
Verified
02bba44df204787e038f92392abdd95f3aec0a96

docs: update `README.md`

ffedeci committed 3 years ago
Unverified
ccff6c81e04e98f5af75ed172e6b103d77d8b27b

feat: convert `default` parameter to string

ffedeci committed 3 years ago
Unverified
f2a22476103346d3053eebfda686f3d93ed04bcd

feat: decrease `help` priority

ffedeci committed 3 years ago

README

The README file for this repository.

⚠️ NOTE: this integration is now @withfig/commander and has moved into the the autocomplete-tools monorepo.

Commander-to-fig

CI

A tool to speed up the workflow of converting Commander commands to Fig completion spec files.


Docs

generateFigSpec(command, filename[, options]): void
  • command: a commander.Command object
  • filename: the output filename of the completion spec file
  • options: an object containing the following optional properties:
    • cwd: specify the working directory in which the file will be saved. It defaults to process.cwd()

Usage

Using this library is as simple as importing a function and calling it.

import { program } from 'commander'
import { generateFigSpec } from '@withfig/commander'

program
  .name('babel')
  .description('The compiler for writing next generation JavaScript')
  .version('1.0.0')
  .argument('<file>', 'file to compile')

generateFigSpec(program, 'babel-spec.ts')

Specify the working directory

For example you may want to generate the file in an home directory subfolder for testing purpose.

import path from 'path'
import os from 'os'

...

// this will output to ~/generated/babel-spec.ts
generateFigSpec(program, 'babel-spec.ts', { cwd: path.join(os.homedir(), 'generated') })

p.s. this tool has been written for commander@8, but should work in the most of the previous versions too.