diff --git a/lib/commands/show.js b/lib/commands/show.js index 56b9341e..9f016ee2 100644 --- a/lib/commands/show.js +++ b/lib/commands/show.js @@ -47,7 +47,7 @@ const cmd = { alias: 'outdir', type: 'string', describe: 'Where to save source code', - default: '.' + default: 'fid' }) .option('q', core.filters.query) .option('t', core.filters.tag) @@ -119,8 +119,12 @@ function showProblem(problem, argv) { } let filename; + if (argv.outdir === 'fid') { + argv.outdir = ("0000" + problem.fid).slice(-4) + '.' + problem.slug; + } if (argv.gen) { file.mkdir(argv.outdir); + // file.mkdir(("0000" + problem.fid).slice(-4)); filename = genFileName(problem, argv); file.write(filename, code); @@ -172,6 +176,7 @@ function showProblem(problem, argv) { } cmd.handler = function(argv) { + session.argv = argv; if (argv.keyword.length > 0) { // show specific one diff --git a/lib/commands/stat.js b/lib/commands/stat.js index 3c51ab98..44cc72dc 100644 --- a/lib/commands/stat.js +++ b/lib/commands/stat.js @@ -98,13 +98,13 @@ function showGraph(problems) { const header = _.range(groups) .map(x => sprintf('%4s%18s', x * 10 + 1, x * 10 + 10)) .join(''); - log.info(' ' + header); + log.info(' ' + header); const graph = []; for (let problem of problems) graph[problem.fid] = ICONS[problem.state] || ICONS.none; - let line = [sprintf(' %03s', 0)]; + let line = [sprintf(' %04s', 0)]; for (let i = 1, n = graph.length; i <= n; ++i) { // padding before group if (i % 10 === 1) line.push(' '); @@ -114,7 +114,7 @@ function showGraph(problems) { // time to start new row if (i % (10 * groups) === 0 || i === n) { log.info(line.join(' ')); - line = [sprintf(' %03s', i)]; + line = [sprintf(' %04s', i)]; } } diff --git a/lib/config.js b/lib/config.js index 9fc26945..5235be6e 100644 --- a/lib/config.js +++ b/lib/config.js @@ -73,7 +73,7 @@ const DEFAULT_CONFIG = { lang: 'cpp' }, file: { - show: '${fid}.${slug}', + show: '${slug}', submission: '${fid}.${slug}.${sid}.${ac}' }, color: {