diff --git a/lib/commands/submit.js b/lib/commands/submit.js index 2e7f2155..666f410d 100644 --- a/lib/commands/submit.js +++ b/lib/commands/submit.js @@ -7,7 +7,7 @@ var core = require('../core'); var h = require('../helper'); var cmd = { - command: 'submit ', + command: 'submit [keyword]', desc: 'submit final solution to leetcode', builder: { } @@ -16,9 +16,10 @@ var cmd = { var INDENT = ' '; cmd.handler = function(argv) { + // if the keyword is not specified // use the 1st section in filename as keyword // e.g. two-sum.cpp, or two-sum.78502271.ac.cpp - var keyword = h.getFilename(argv.filename).split('.')[0]; + var keyword = argv.keyword || h.getFilename(argv.filename).split('.')[0]; core.getProblem(keyword, function(e, problem) { if (e) return log.fail(e); diff --git a/lib/commands/test.js b/lib/commands/test.js index 9f594c0b..a1b7fbe6 100644 --- a/lib/commands/test.js +++ b/lib/commands/test.js @@ -8,7 +8,7 @@ var core = require('../core'); var h = require('../helper'); var cmd = { - command: 'test ', + command: 'test [keyword]', desc: 'send solution to leetcode and run test', builder: { testcase: { @@ -50,9 +50,10 @@ function prettyLine(actual, expected, key) { } function runTest(argv) { + // if the keyword is not specified // use the 1st section in filename as keyword // e.g. two-sum.cpp, or two-sum.78502271.ac.cpp - var keyword = h.getFilename(argv.filename).split('.')[0]; + var keyword = argv.keyword || h.getFilename(argv.filename).split('.')[0]; core.getProblem(keyword, function(e, problem) { if (e) return log.fail(e); diff --git a/lib/config.js b/lib/config.js index 0525dd9c..363588bf 100644 --- a/lib/config.js +++ b/lib/config.js @@ -17,7 +17,7 @@ var DEFAULT_CONFIG = { URL_FAVORITE_DELETE: 'https://leetcode.com/list/api/questions/$hash/$id', // but you will want change these - LANG: 'cpp', // avail: [c,cpp,csharp,golang,java,javascript,python,ruby,swift] + LANG: 'javascript', // avail: [c,cpp,csharp,golang,java,javascript,python,ruby,swift] AUTO_LOGIN: false, USE_COLOR: true, COLOR_THEME: 'default',