UNPKG

docutils-ts

Version:

Port of the Python Docutils library to TypeScript

15 lines (14 loc) 557 B
import { Action } from 'argparse'; export class ActionCallback extends Action { constructor(options) { super(options); this.callback = typeof options.callback !== 'undefined' ? options.callback : undefined; this.callbackArgs = typeof options.callbackArgs !== 'undefined' ? options.callbackArgs : undefined; } call(parser, namespace, values, optionString) { if (this.callback === undefined) { return; } this.callback(parser, namespace, values, optionString, this.callbackArgs); } }