From 016f76b1e73e53c8287b87960afe0b285f342f4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alvaro=20Cabrera=20Dur=C3=A1n?= <pateketrueke@gmail.com>
Date: Wed, 30 Oct 2019 16:41:12 -0600
Subject: [PATCH] FIXME: handle argv

---
 bin/gen.js   | 14 +++++++++++++-
 package.json |  1 +
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/bin/gen.js b/bin/gen.js
index 4cdfd813..0b1c4345 100755
--- a/bin/gen.js
+++ b/bin/gen.js
@@ -2,10 +2,18 @@
 
 const jsf = require('../dist/main.umd.js');
 
-// FIXME: load faker/change on startup?
+// FIXME: load faker/chance on startup?
 
 const sample = process.argv.slice(2)[0];
 
+// FIXME: setup argv....
+const argv = require('wargs')(process.argv.slice(2), {
+  boolean: 'O',
+  alias: {
+    'always-fake-optionals': 'O',
+  },
+});
+
 const { inspect } = require('util');
 const { Transform } = require('stream');
 const { readFileSync } = require('fs');
@@ -13,6 +21,10 @@ const { readFileSync } = require('fs');
 const pretty = process.argv.indexOf('--pretty') !== -1;
 const noColor = process.argv.indexOf('--no-color') !== -1;
 
+jsf.option({
+  alwaysFakeOptionals: true,
+});
+
 function generate(schema, callback) {
   jsf.resolve(JSON.parse(schema)).then(result => {
     let sample;
diff --git a/package.json b/package.json
index e1855c74..ddc3ee49 100644
--- a/package.json
+++ b/package.json
@@ -137,6 +137,7 @@
     "terser": "^4.3.9",
     "tv4": "^1.3.0",
     "vue-template-compiler": "^2.6.10",
+    "wargs": "^0.8.4",
     "z-schema": "^4.1.0"
   },
   "dependencies": {
-- 
GitLab