-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
339 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
const path = require('path'); | ||
const Params = require('./params'); | ||
const Option = require('./option'); | ||
const Command = require('./command'); | ||
const Error = require('./parse-argv-error'); | ||
const getCommandHelp = require('./help'); | ||
import { basename, extname } from 'path'; | ||
import Params from './params.js'; | ||
import Option from './option.js'; | ||
import Command from './command.js'; | ||
import Error from './parse-argv-error.js'; | ||
import getCommandHelp from './help.js'; | ||
|
||
function nameFromProcessArgv() { | ||
return path.basename(process.argv[1], path.extname(process.argv[1])); | ||
return basename(process.argv[1], extname(process.argv[1])); | ||
} | ||
|
||
module.exports = { | ||
function command(name, params, config) { | ||
name = name || nameFromProcessArgv() || 'command'; | ||
|
||
return new Command(name, params, config); | ||
} | ||
|
||
export { | ||
Error, | ||
Params, | ||
Command, | ||
Option, | ||
|
||
getCommandHelp, | ||
command: function(name, params, config) { | ||
name = name || nameFromProcessArgv() || 'command'; | ||
|
||
return new Command(name, params, config); | ||
} | ||
command | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.