Skip to content

Commit

Permalink
Yargs12 (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xGabi authored and kernelwhisperer committed Mar 5, 2019
1 parent 0f5b483 commit 77a5601
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 90 deletions.
2 changes: 1 addition & 1 deletion packages/aragon-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"truffle-hdwallet-provider": "^1.0.2",
"truffle-hdwallet-provider-privkey": "^0.3.0",
"web3": "1.0.0-beta.34",
"yargs": "^10.1.0"
"yargs": "12.0.5"
},
"devDependencies": {
"@aragon/apps-finance": "^2.0.0",
Expand Down
11 changes: 4 additions & 7 deletions packages/aragon-cli/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ const MIDDLEWARES = [
]

// Set up commands
const cmd = require('yargs').commandDir('./commands', {
visit: cmd => {
// Add middlewares
cmd.middlewares = MIDDLEWARES
return cmd
},
}) // .strict()
const cmd = require('yargs').commandDir('./commands')
// .strict()

cmd.middleware(MIDDLEWARES)

cmd.alias('h', 'help')
cmd.alias('v', 'version')
Expand Down
25 changes: 3 additions & 22 deletions packages/aragon-cli/src/commands/apm.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
const {
manifestMiddleware,
moduleMiddleware,
environmentMiddleware,
} = require('../middleware')

const MIDDLEWARES = [
manifestMiddleware,
moduleMiddleware,
environmentMiddleware,
]

exports.command = 'apm <command>'

exports.describe = 'Publish and manage your APM package'

exports.aliases = ['package']

exports.builder = function(yargs) {
const cmd = yargs.commandDir('apm_cmds', {
visit: cmd => {
// Add middlewares
cmd.middlewares = MIDDLEWARES
return cmd
},
})
cmd.demandCommand(1, 'You need to specify a command')

return cmd
return yargs
.commandDir('apm_cmds')
.demandCommand(1, 'You need to specify a command')
}
25 changes: 3 additions & 22 deletions packages/aragon-cli/src/commands/dao.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
const daoArg = require('./dao_cmds/utils/daoArg')
const {
manifestMiddleware,
moduleMiddleware,
environmentMiddleware,
} = require('../middleware')

const MIDDLEWARES = [
manifestMiddleware,
moduleMiddleware,
environmentMiddleware,
]

exports.command = 'dao <command>'

Expand All @@ -19,15 +8,7 @@ exports.builder = function(yargs) {
if (process.argv[3] !== 'new' && process.argv[3] !== 'act') {
yargs = daoArg(yargs)
}

const cmd = yargs.commandDir('dao_cmds', {
visit: cmd => {
// Add middlewares
cmd.middlewares = MIDDLEWARES
return cmd
},
})
cmd.demandCommand(1, 'You need to specify a command')

return cmd
return yargs
.commandDir('dao_cmds')
.demandCommand(1, 'You need to specify a command')
}
19 changes: 1 addition & 18 deletions packages/aragon-cli/src/commands/dao_cmds/acl.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
const viewCommand = require('./acl_cmds/view')

const {
manifestMiddleware,
moduleMiddleware,
environmentMiddleware,
} = require('../../middleware')

const MIDDLEWARES = [
manifestMiddleware,
moduleMiddleware,
environmentMiddleware,
]

exports.command = 'acl <dao>'

exports.describe = 'Shortcut for aragon dao acl view <dao>'

exports.builder = function(yargs) {
return yargs.commandDir('acl_cmds', {
visit: cmd => {
cmd.middlewares = MIDDLEWARES
return cmd
},
})
return yargs.commandDir('acl_cmds')
}

exports.handler = viewCommand.handler
19 changes: 1 addition & 18 deletions packages/aragon-cli/src/commands/dao_cmds/token.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
const {
manifestMiddleware,
moduleMiddleware,
environmentMiddleware,
} = require('../../middleware')

const MIDDLEWARES = [
manifestMiddleware,
moduleMiddleware,
environmentMiddleware,
]

exports.command = 'token <command>'

exports.describe = 'Create and interact with MiniMe tokens'

exports.builder = function(yargs) {
return yargs
.commandDir('token_cmds', {
visit: cmd => {
cmd.middlewares = MIDDLEWARES
return cmd
},
})
.commandDir('token_cmds')
.demandCommand(1, 'You need to specify a command')
}
4 changes: 2 additions & 2 deletions packages/create-aragon-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-aragon-app",
"version": "1.0.6",
"version": "1.0.8",
"description": "Aragon command-line tool to create aragon apps",
"main": "dist/cli.js",
"bin": {
Expand All @@ -13,7 +13,7 @@
},
"repository": {
"type": "git",
"url": ""
"url": "https://github.com/aragon/aragon-cli/tree/master/packages/create-aragon-app"
},
"keywords": [
"create-aragon-app",
Expand Down

0 comments on commit 77a5601

Please sign in to comment.