Repository: FHIR/sushi (ts)

Issue:
Can no longer just run `sushi`
We used to be able to do `sushi` to run SUSHI on the current working directory, but now we have to do `sushi .`. I don't think there is a good reason why we can't just assume `.` when there is no input directory, so we should bring back `sushi` with no dot as an allowed command.

Pull request description:
Set input directory default
This PR fixes #627. There was a bug where you could no longer run `sushi` (without the input directory specified). This was because we were trying to use the input directory in a `path.resolve` before we had set a default if it was not specified. I moved that functionality to it's own function and called it earlier to ensure we always have a default value when we try to use it.

Patch:
diff --git a/src/app.ts b/src/app.ts
index af55782..8103f32 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -13,6 +13,7 @@ import { loadCustomResources } from './fhirdefs';
 import { FHIRDefinitions } from './fhirdefs';
 import { Configuration } from './fshtypes';
 import {
+  ensureInputDir,
   findInputDir,
   ensureOutputDir,
   readConfig,
@@ -67,6 +68,7 @@ async function app() {
     process.exit(0);
   }
   if (program.debug) logger.level = 'debug';
+  input = ensureInputDir(input);
 
   logger.info(`Running ${getVersion()}`);
 
diff --git a/src/utils/Processing.ts b/src/utils/Processing.ts
index 9f1b4e1..1d05484 100644
--- a/src/utils/Processing.ts
+++ b/src/utils/Processing.ts
@@ -22,13 +22,16 @@ import {
 import { Configuration } from '../fshtypes';
 import { loadConfigurationFromIgResource } from '../import/loadConfigurationFromIgResource';
 
-export function findInputDir(input: string): string {
+export function ensureInputDir(input: string): string {
   // If no input folder is specified, set default to current directory
   if (!input) {
     input = '.';
     logger.info('path-to-fsh-defs defaulted to current working directory');
   }
+  return input;
+}
 
+export function findInputDir(input: string): string {
   const originalInput = input;
 
   // TODO: Legacy support. Remove when no longer supported.


Test patch:
diff --git a/test/utils/Processing.test.ts b/test/utils/Processing.test.ts
index 98c0f22..d53eb72 100644
--- a/test/utils/Processing.test.ts
+++ b/test/utils/Processing.test.ts
@@ -6,6 +6,7 @@ import { minimalConfig } from './minimalConfig';
 import { loggerSpy } from '../testhelpers/loggerSpy';
 import readlineSync from 'readline-sync';
 import {
+  ensureInputDir,
   findInputDir,
   ensureOutputDir,
   readConfig,
@@ -40,7 +41,7 @@ describe('Processing', () => {
     });
 
     it('should find a path to the current working directory when no input folder is specified', () => {
-      const foundInput = findInputDir(undefined);
+      const foundInput = ensureInputDir(undefined);
       expect(foundInput).toBe('.');
     });