UNPKG

@folder/synonyms

Version:

Get synonyms for a word from OpenAI GPT-3 or GPT-4, or the WordsAPI. Optionally breaks hyphenated words into their parts and gets synonyms for each one. API and CLI.

25 lines (19 loc) 436 B
#!/usr/bin/env node const synonym = require('..'); const opts = { alias: { k: 'apiKey', j: 'join', s: 'split', v: 'version' } }; const args = require('minimist')(process.argv.slice(2), opts); const { _: names, ...options } = args; if (args.version) { console.log('synonyms', `v${require('../package.json').version}`); process.exit(0); } synonym(names, options) .then(console.log) .catch(console.error);