-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial layout, arg parsing and main
- Loading branch information
Showing
4 changed files
with
112 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Logs | ||
logs | ||
*.log | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git | ||
node_modules |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
parser = require('argv-parser'); | ||
main = require('./main'); | ||
|
||
var rules = { | ||
organization: { | ||
type: String, | ||
required: true, | ||
short: 'o' | ||
}, | ||
command: { | ||
type: String, | ||
required: true, | ||
short: 'c' | ||
}, | ||
password: { | ||
type: String, | ||
required: true, | ||
short: 's' | ||
}, | ||
username: { | ||
type: String, | ||
required: true, | ||
short: 'u', | ||
}, | ||
baseurl: { | ||
type: String, | ||
required: true, | ||
short: 'b', | ||
}, | ||
directory: { | ||
type: String, | ||
required: false, | ||
short: 'd', | ||
default: '.' | ||
}, | ||
}; | ||
var data = parser.parse( process.argv, { rules: rules } ); | ||
|
||
data.parsed.orgUrl = data.parsed.baseurl + "/v1/o/" + data.parsed.organization; | ||
|
||
if ( data.parsed.command == "import" ) { | ||
main.import( data ); | ||
} | ||
else if ( data.parsed.command == "execute" ) { | ||
main.execute( data ); | ||
} | ||
else { | ||
console.log( 'Unknown command: ' + data.parsed.command ); | ||
console.log( 'Command must be one of: import|execute' ); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var jf = require('jsonfile'); | ||
var util = require('util'); | ||
|
||
module.exports = { | ||
import: Import, | ||
execute: Execute | ||
} | ||
|
||
function Import( data ) { | ||
console.log( util.inspect(data) ); | ||
} | ||
|
||
function Execute( data ) { | ||
console.log( util.inspect(data) ); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "apigeeOrgAdmin", | ||
"version": "0.8.0", | ||
"description": "A CLI for Administering Apigee Edge Organizations", | ||
"main": "lib/main.js", | ||
"bin": { | ||
"apigeeOrgAdmin": "lib/cli.js" | ||
}, | ||
"keywords": [ | ||
"Apigee", | ||
"CLI" | ||
], | ||
"author": "Geir Sjurseth <[email protected]>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"argv-parser": "*", | ||
"util": "*", | ||
"jsonfile": "*" | ||
} | ||
} |