@@ -3,6 +3,7 @@ import {CommandModule} from "yargs";
3
3
import { Parser } from "./parser" ;
4
4
import * as defaultCmd from "./default_cmd" ;
5
5
import * as state from "./state" ;
6
+ import * as fs from "fs-extra" ;
6
7
7
8
process . on ( 'uncaughtException' , ( err ) => {
8
9
process . stderr . write ( `${ err . stack ? err . stack : err } \n` ) ;
@@ -29,20 +30,24 @@ Array.prototype.first = function() {
29
30
} ;
30
31
31
32
const argv = yargs
32
- . version ( "4.6.1 " )
33
+ . version ( "4.7.0 " )
33
34
. showHelpOnFail ( false )
34
- . wrap ( 180 )
35
+ . wrap ( yargs . terminalWidth ( ) )
35
36
. command ( defaultCmd as CommandModule )
36
37
. usage ( "Find more information at https://github.com/firecow/gitlab-ci-local" )
38
+ . strictOptions ( )
37
39
. option ( "manual" , { type : "array" , description : "One or more manual jobs to run during a pipeline" , requiresArg : true } )
38
40
. option ( "list" , { type : "string" , description : "List jobs and job information" , requiresArg : false } )
39
41
. option ( "cwd" , { type : "string" , description : "Path to a gitlab-ci.yml" , requiresArg : true } )
40
42
. option ( "completion" , { type : "string" , description : "Generate bash completion script" , requiresArg : false } )
41
43
. option ( "needs" , { type : "boolean" , description : "Run needed jobs, when executing a single job" , requiresArg : false } )
42
- . completion ( "completion" , false , async ( current , a ) => {
43
- const cwd = a . cwd as string || process . cwd ( ) ;
44
+ . completion ( "completion" , false , async ( current , yargsArgv ) => {
45
+ const cwd = yargsArgv . cwd as string || process . cwd ( ) ;
44
46
const pipelineIid = await state . getPipelineIid ( cwd ) ;
45
47
const parser = await Parser . create ( cwd , pipelineIid , true ) ;
48
+ // await fs.appendFile(".gitlab-ci-bash-complete.log", JSON.stringify(current) + "\n");
49
+ // await fs.appendFile(".gitlab-ci-bash-complete.log", JSON.stringify(yargsArgv) + "\n");
50
+ // await fs.appendFile(".gitlab-ci-bash-complete.log", "\n");
46
51
return parser . getJobNames ( ) ;
47
52
} )
48
53
. argv ;
0 commit comments