# all files / src/models/ sub-command.js

100% Statements 38/38
100% Branches 22/22
100% Functions 9/9
100% Lines 10/10
2 statements, 5 branches Ignored

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    261×
    1×

    2×
    2×
    2×
    2×

    2×

    1×

    1×

     import ProjectSettings from './project-settings';
    import UI from './ui';

    class SubCommand {
      constructor(options = {}) {
        this.rawOptions = options;
        this.settings = options.settings || new ProjectSettings();
        this.ui = options.ui || new UI();

        this.environment = {
          ui: this.ui,
          settings: this.settings
        };
      }

      run() {
        throw new Error('Subcommands must implement a run()');
      }

      availableOptions() {
        throw new Error('Subcommands must implement an availableOptions()');
      }
    }

    export default SubCommand;