From 057913ddb37ccd17523002334d831170ad2085b6 Mon Sep 17 00:00:00 2001 From: Corey Butler Date: Sun, 3 May 2020 21:48:59 -0500 Subject: [PATCH] Added ability to retrieve named flag using metadata flag() method. --- package-lock.json | 2 +- package.json | 2 +- src/command.js | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4558808..3571c5d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@author.io/shell", - "version": "1.5.2", + "version": "1.5.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d0f79ff..af957c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@author.io/shell", - "version": "1.5.2", + "version": "1.5.3", "description": "A micro-framework for creating CLI-like experiences. This supports Node.js and browsers.", "main": "src/index.js", "scripts": { diff --git a/src/command.js b/src/command.js index bf14056..37a51fb 100644 --- a/src/command.js +++ b/src/command.js @@ -402,6 +402,10 @@ export default class Command extends Base { return pdata.flagSource[name].value } } catch (e) { + if (this.arguments.has(name)) { + return Array.from(parser.unrecognizedFlags)[args.indexOf(name)] + } + return undefined } }