Skip to content

Commit

Permalink
initial, and maybe only commit
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnewell committed Dec 1, 2020
1 parent 2b806d7 commit 14580ea
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
18 changes: 18 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function parse (string = '') {
const response = {}
response.args = {}
const strArray = string.split(/ /)
response.command = strArray.shift()
const rejoined = strArray.join(' ')
const resplit = rejoined.split(/--/)
resplit.shift()
resplit.forEach(val => {
const arr = val.split(/ /)
const name = arr.shift()
response.args[name] = arr.join(' ').trim()
})

return response
}

module.exports = parse
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "simple-commando",
"version": "0.1.0",
"description": "A simpler commando",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/danielnewell/simple-commando.git"
},
"author": "Daniel Newell <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/danielnewell/simple-commando/issues"
},
"homepage": "https://github.com/danielnewell/simple-commando#readme"
}

0 comments on commit 14580ea

Please sign in to comment.