Test Setup Failed
Push — master ( 624702...8ee19e )
by recca
02:47 queued 19s
created

resources/assets/js/commands/artisan.js   A

Size

Lines of Code 35

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
nc 1
dl 0
loc 35
rs 10
c 2
b 1
f 0
noi 0
1
'use strict';
2
3
import Command from './command';
4
5
export default class Artisan extends Command {
6
    match(name) {
7
        return name === 'artisan';
8
    }
9
10
    call(cmd) {
11
        let rest = $.terminal.parseCommand(cmd.rest.trim());
12
        if (this.api.options.environment === 'production' &&
13
            rest.args.includes('--force') === false &&
14
            this.api.options.confirmToProceed[cmd.name].includes(rest.name) === true
15
        ) {
16
            this.api.$term.echo(this.api.comment('**************************************'));
17
            this.api.$term.echo(this.api.comment(`*     Application In Production!     *`));
18
            this.api.$term.echo(this.api.comment('**************************************'));
19
            this.api.$term.echo(' ');
20
21
            let promise = this.api.confirm(`${this.api.info('Do you really wish to run this command? [y/N] (yes/no)')} ${this.api.comment('[no]')}: `)
22
            promise.then(() => {
23
                cmd.command = `artisan --command="${this.addslashes(cmd.rest)}"`;
24
                super.call(cmd);
25
            }, () => {
26
                this.$term.echo(" ");
27
                this.$term.echo(`${this.comment('Command Cancelled!')}`);
28
                this.$term.echo(" ");
29
            });
30
        } else {
31
            cmd.command = `artisan --command="${this.addslashes(cmd.rest)}"`;
32
            super.call(cmd);
33
        }
34
    }
35
}
36