<commit_before>import yargs from 'yargs'
import encoda from '@stencila/encoda'

const VERSION = require('../package').version

yargs
  .scriptName('stencila')

  .command(
    'convert [input] [output]',
    'Convert between file formats',
    (args: yargs.Argv<{}>): yargs.Argv<any> => {
      return args
        .positional('input', {
          describe: 'The input file path. Defaults to standard input.',
          type: 'string',
          default: '-'
        })
        .positional('output', {
          describe: 'The output file path. Defaults to standard output.',
          type: 'string',
          default: '-'
        })
        .option('from', {
          describe: 'The format to convert the input from.',
          type: 'string'
        })
        .option('to', {
          describe: 'The format to convert the output to.',
          type: 'string'
        })
    },
    async (argv: any): Promise<void> => {
      const {input, output, ...options} = argv
      await encoda.convert(input, output, options)
      cleanup()
    }
  )

  // Any command-line argument given that is not demanded, or does not have a corresponding description, will be reported as an error.
  // Unrecognized commands will also be reported as errors.
  .strict()

  // Maximize width of usage instructions
  .wrap(yargs.terminalWidth())

  // Help global option
  .usage('$0 <cmd> [args]')
  .alias('help', 'h')

  // Version global option
  .version(VERSION)
  .alias('version', 'v')
  .describe('version', 'Show version')

  .parse()


  function cleanup() {
    // Trigger a clean up
    //   "The 'beforeExit' event is not emitted for conditions causing
    //   explicit termination, such as calling process.exit() or uncaught
    //   exceptions."
    process.emit('beforeExit', 0)
  }
<commit_msg>fix: Correct the import for encoda<commit_after>import yargs from 'yargs'
import * as encoda from '@stencila/encoda'

const VERSION = require('../package').version

yargs
  .scriptName('stencila')

  .command(
    'convert [input] [output]',
    'Convert between file formats',
    (args: yargs.Argv<{}>): yargs.Argv<any> => {
      return args
        .positional('input', {
          describe: 'The input file path. Defaults to standard input.',
          type: 'string',
          default: '-'
        })
        .positional('output', {
          describe: 'The output file path. Defaults to standard output.',
          type: 'string',
          default: '-'
        })
        .option('from', {
          describe: 'The format to convert the input from.',
          type: 'string'
        })
        .option('to', {
          describe: 'The format to convert the output to.',
          type: 'string'
        })
    },
    async (argv: any): Promise<void> => {
      const {input, output, ...options} = argv
      await encoda.convert(input, output, options)
      cleanup()
    }
  )

  // Any command-line argument given that is not demanded, or does not have a corresponding description, will be reported as an error.
  // Unrecognized commands will also be reported as errors.
  .strict()

  // Maximize width of usage instructions
  .wrap(yargs.terminalWidth())

  // Help global option
  .usage('$0 <cmd> [args]')
  .alias('help', 'h')

  // Version global option
  .version(VERSION)
  .alias('version', 'v')
  .describe('version', 'Show version')

  .parse()


  function cleanup() {
    // Trigger a clean up
    //   "The 'beforeExit' event is not emitted for conditions causing
    //   explicit termination, such as calling process.exit() or uncaught
    //   exceptions."
    process.emit('beforeExit', 0)
  }

{'fraction_non_alphanumeric': 0.13561190738699008, 'fraction_numerical': 0.0011025358324145535, 'mean_word_length': 2.3354779411764706, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3649602', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1037, 'n_words': 342}