Skip to content

Commit

Permalink
clear groups in reset and enforce option uniqueness per group
Browse files Browse the repository at this point in the history
  • Loading branch information
nexdrew committed Jan 9, 2016
1 parent de5818a commit 97e1beb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function Argv (processArgs, cwd) {
completion = Completion(self, usage)

demanded = {}
groups = {}

exitProcess = true
strict = false
Expand Down Expand Up @@ -342,7 +343,11 @@ function Argv (processArgs, cwd) {

var groups = {}
self.group = function (opts, groupName) {
groups[groupName] = (groups[groupName] || []).concat(opts)
var seen = {}
groups[groupName] = (groups[groupName] || []).concat(opts).filter(function (key) {
if (seen[key]) return false
return (seen[key] = true)
})
return self
}
self.getGroups = function () {
Expand Down

0 comments on commit 97e1beb

Please sign in to comment.