From d30985efc5f2ab6f56f4ed55f7bcf485269ff328 Mon Sep 17 00:00:00 2001 From: Steve Peak Date: Fri, 17 Mar 2017 09:59:10 -0400 Subject: [PATCH] add support for flags --- bin/codecov | 1 + lib/codecov.js | 5 +++++ test/index.js | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/bin/codecov b/bin/codecov index 5704a0a8..ff9da26f 100755 --- a/bin/codecov +++ b/bin/codecov @@ -18,6 +18,7 @@ var args = argv.option([ {name: 'build', short: 'B', type: 'string', description: "Specify a custom build number to distinguish ci jobs, provided automatically for supported ci companies"}, {name: 'slug', short: 'r', type: 'string', description: "Specify repository slug for Enterprise ex. owner/repo"}, {name: 'url', short: 'u', type: 'string', description: "Your Codecov endpoint"}, + {name: 'flags', short: 'F', type: 'string', description: "Codecov Flags"}, {name: 'dump', type: 'boolean', description: "Dump collected data and do not send to Codecov"} ]).run(); diff --git a/lib/codecov.js b/lib/codecov.js index ae6a3d8e..c547e3db 100644 --- a/lib/codecov.js +++ b/lib/codecov.js @@ -180,6 +180,11 @@ var upload = function(args, on_success, on_failure){ query.slug = args.options.slug; } + var flags = (args.options.flags || process.env.codecov_flags || process.env.CODECOV_FLAGS); + if (flags) { + query.flags = flags; + } + var token = (args.options.token || process.env.codecov_token || process.env.CODECOV_TOKEN); if (token){ query.token = token; diff --git a/test/index.js b/test/index.js index 2996b636..68b932e8 100644 --- a/test/index.js +++ b/test/index.js @@ -101,6 +101,11 @@ describe("Codecov", function(){ expect(res.query.slug).to.eql('value'); }); + it("can get flags from cli args", function(){ + var res = codecov.upload({options: {dump: true, flags: 'value'}}); + expect(res.query.flags).to.eql('value'); + }); + it("can include env in cli", function(){ process.env.HELLO = 'world'; var res = codecov.upload({options: {dump: true, env: 'HELLO,VAR1'}});