Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/cli/unknown.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ErrorCode } from '../deploy';
import { printHelp } from '../help';
import args from './args';
import { warn } from './messages';
Expand All @@ -10,6 +11,8 @@ export const handleUnknownArgs = (): void => {
', '
)} does not exist as a valid command.`;
warn(message);
printHelp(ErrorCode.UnknownFlag);
return;
}

printHelp();
Expand Down
13 changes: 7 additions & 6 deletions src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ import { filterFiles, getEnv, loadFilesToRun, zip } from './utils';

export enum ErrorCode {
Ok = 0,
NotDirectoryRootPath = 1,
EmptyRootPath = 2,
NotFoundRootPath = 3,
AccountDisabled = 4,
DeployPackageFailed = 5,
DeployRepositoryFailed = 6
UnknownFlag = 1,
NotDirectoryRootPath = 2,
EmptyRootPath = 3,
NotFoundRootPath = 4,
AccountDisabled = 5,
DeployPackageFailed = 6,
DeployRepositoryFailed = 7
}

export const deployPackage = async (
Expand Down
4 changes: 2 additions & 2 deletions src/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Examples:
For more information, visit: https://github.com/metacall/deploy
`;

export const printHelp = (): void => {
export const printHelp = (exitCode: ErrorCode = ErrorCode.Ok): void => {
console.log(helpText);
return process.exit(ErrorCode.Ok);
return process.exit(exitCode);
};