Browse Source

code refactor

MaysWind 6 years ago
parent
commit
ae8f173849
2 changed files with 3 additions and 2 deletions
  1. 2 1
      main/cmd.js
  2. 1 1
      main/main.js

+ 2 - 1
main/cmd.js

@@ -1,12 +1,13 @@
 'use strict';
 
 const argv = require('yargs')
-    .usage('Usage: $0 [file] [options]')
+    .usage('Usage: $0 <file> [options]')
     .option('d', {
         alias: 'development',
         type: 'boolean',
         describe: 'Enable Development Mode (press F12 to open DevTools)',
     })
+    .command('$0 <file> [options]', 'Create new task from specified file')
     .help('h')
     .alias('h', 'help')
     .parse(process.argv.slice(1));

+ 1 - 1
main/main.js

@@ -20,7 +20,7 @@ if (!singletonLock) {
     app.quit();
 }
 
-let filePathInCommandLine = process.argv.length > 1 && process.argv[1];
+let filePathInCommandLine = cmd.argv.file;
 
 function isEnableCloseToHide() {
     return tray.isEnabled() || os.platform() === 'darwin';