Repository: lirantal/lockfile-lint (js)

Issue:
Error could be more descriptive
**Is your feature request related to a problem? Please describe.**

Using this command `lockfile-lint --type npm --allowed-hosts npm github.com --allowed-schemes 'https:' 'git+https:'` resulted in error 

```
Usage: lockfile-lint --path <path-to-lockfile> --allowed-hosts yarn npm

Options:
      --version          Show version number                           [boolean]
  -h, --help             Show help                                     [boolean]
  -p, --path             path to the lockfile                [string] [required]
  -t, --type             lockfile type, options are "npm" or "yarn"     [string]
  -s, --validate-https   validates the use of HTTPS as protocol schema for all
                         resources                                     [boolean]
  -e, --empty-hostname   allows empty hostnames, or set to false if you wish for
                         a stricter policy             [boolean] [default: true]
  -a, --allowed-hosts    validates a whitelist of allowed hosts to be used for
                         resources in the lockfile                       [array]
  -o, --allowed-schemes  validates a whitelist of allowed schemes to be used for
                         resources in the lockfile                       [array]
  -u, --allowed-urls     validates a whitelist of allowed URLs to be used for
                         resources in the lockfile                       [array]

Examples:
  lockfile-lint --path yarn.lock --validate-https
  lockfile-lint --path yarn.lock --validate-https --allowed-hosts npm yarn
  verdaccio
  lockfile-lint --path yarn.lock --allowed-schemes "https:" "git+ssh:"
  --allowed-hosts npm yarn verdaccio

curated by Liran Tal at https://github.com/lirantal/lockfile-lint

Missing required argument: p
```

**Describe the solution you'd like**

1. The error should be the first thing the users should see. Getting this multiple times resulted in confusion over what exactly is the error. 
2. The error's intention is a bit shaky. Reading about it in the tests, 

https://github.com/lirantal/lockfile-lint/blob/f1ae11ef18b1229360d7bb835cc1d1c931087211/packages/lockfile-lint/__tests__/config.test.js#L39-L45

I think what can be improved is the message which can be: This error is shown when the required parameter (path) is missing. I am already providing parameters, it's just the path parameter that is missing. 

3. I think instead of just mentioning 

`Missing required argument: p`, how about we show `Missing required argument: path`

Mentioning just `p` probably was confusing. 


I am happy to help create a PR but I can't find where the error for this is thrown. Let me know what you feel about this issue and I can create a PR. Thanks!



Pull request:
fix: better error messages that use the long-form alias of CLI flags
Fixes #115 by providing referencing the long-form alias path of a CLI flag if it has errors associated with it, rather than the short-form single letter flag.

Patch:
diff --git a/.changeset/weak-grapes-drum.md b/.changeset/weak-grapes-drum.md
new file mode 100644
index 0000000..21a290b
--- /dev/null
+++ b/.changeset/weak-grapes-drum.md
@@ -0,0 +1,5 @@
+---
+'lockfile-lint': patch
+---
+
+Friendly error messages by referencing the long-form CLI flag
diff --git a/package.json b/package.json
index fae2da1..9346101 100644
--- a/package.json
+++ b/package.json
@@ -41,7 +41,6 @@
     "linters": {
       "**/*.js": [
         "prettier-standard",
-        "npm run lint",
         "git add"
       ]
     }
diff --git a/packages/lockfile-lint/src/config.js b/packages/lockfile-lint/src/config.js
index 4a808a4..9d1e149 100644
--- a/packages/lockfile-lint/src/config.js
+++ b/packages/lockfile-lint/src/config.js
@@ -29,59 +29,59 @@ module.exports = (argv, exitProcess = false, searchFrom = process.cwd()) => {
     .help('help')
     .alias('help', 'h')
     .options({
-      p: {
-        alias: ['path'],
+      path: {
+        alias: ['p'],
         type: 'string',
         describe: 'path to the lockfile',
         demandOption: true
       },
-      t: {
-        alias: ['type'],
+      type: {
+        alias: ['t'],
         type: 'string',
         describe: 'lockfile type, options are "npm" or "yarn"'
       },
-      s: {
-        alias: ['validate-https'],
+      'validate-https': {
+        alias: ['s'],
         type: 'boolean',
         describe: 'validates the use of HTTPS as protocol schema for all resources'
       },
-      n: {
-        alias: ['validate-package-names'],
+      'validate-package-names': {
+        alias: ['n'],
         type: 'boolean',
         describe:
           "validates that the resource URL specifies the same package name as that listed as the lockfile entry's key",
         implies: 'allowed-hosts'
       },
-      i: {
-        alias: ['validate-integrity'],
+      'validate-integrity': {
+        alias: ['i'],
         type: 'boolean',
         describe: 'validates that the integrity hash type is sha512'
       },
-      e: {
-        alias: 'empty-hostname',
+      'empty-hostname': {
+        alias: 'e',
         type: 'boolean',
         default: true,
         describe: 'allows empty hostnames, or set to false if you wish for a stricter policy'
       },
-      a: {
-        alias: ['allowed-hosts'],
+      'allowed-hosts': {
+        alias: ['a'],
         type: 'array',
         describe: 'validates a whitelist of allowed hosts to be used for resources in the lockfile'
       },
-      o: {
-        alias: ['allowed-schemes'],
+      'allowed-schemes': {
+        alias: ['o'],
         type: 'array',
         describe:
           'validates a whitelist of allowed schemes to be used for resources in the lockfile',
         conflicts: ['validate-https', 's']
       },
-      u: {
-        alias: ['allowed-urls'],
+      'allowed-urls': {
+        alias: ['u'],
         type: 'array',
         describe: 'validates a whitelist of allowed URLs to be used for resources in the lockfile'
       },
-      f: {
-        alias: ['format'],
+      format: {
+        alias: ['f'],
         type: 'string',
         description: 'format of the report output',
         choices: ['plain', 'pretty'],


Test patch:
diff --git a/packages/lockfile-lint/__tests__/cli.test.js b/packages/lockfile-lint/__tests__/cli.test.js
index bdeda69..613cb0c 100644
--- a/packages/lockfile-lint/__tests__/cli.test.js
+++ b/packages/lockfile-lint/__tests__/cli.test.js
@@ -4,7 +4,11 @@ const path = require('path')
 // eslint-disable-next-line security/detect-child-process
 const childProcess = require('child_process')
 const cliExecPath = path.join(__dirname, '../bin/lockfile-lint.js')
-const {ValidateHostManager, ValidateUrlManager, ValidateIntegrityManager} = require('../src/validators/index')
+const {
+  ValidateHostManager,
+  ValidateUrlManager,
+  ValidateIntegrityManager
+} = require('../src/validators/index')
 
 describe('CLI tests', () => {
   test('Running without parameters should display help', done => {
@@ -194,7 +198,9 @@ describe('CLI tests', () => {
     })
 
     process.stderr.on('close', _ => {
-      expect(output.indexOf('Arguments o and validate-https are mutually exclusive')).not.toBe(-1)
+      expect(
+        output.indexOf('Arguments allowed-schemes and validate-https are mutually exclusive')
+      ).not.toBe(-1)
       done()
     })
   })
diff --git a/packages/lockfile-lint/__tests__/config.test.js b/packages/lockfile-lint/__tests__/config.test.js
index 531c1d1..9493647 100644
--- a/packages/lockfile-lint/__tests__/config.test.js
+++ b/packages/lockfile-lint/__tests__/config.test.js
@@ -45,7 +45,7 @@ describe('config', () => {
   })
 
   test('providing conflicting arguments should display an error', () => {
-    const errorMessageExpression = /arguments o and validate-https are mutually exclusive/i
+    const errorMessageExpression = /Arguments allowed-schemes and validate-https are mutually exclusive/i
 
     expect(() =>
       loadConfig(