Skip to content

Commit

Permalink
Error if -n is not specified when specifying URL
Browse files Browse the repository at this point in the history
  • Loading branch information
ta-Hirose committed Aug 16, 2022
1 parent 96cb025 commit bedbb61
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion dim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ await new Command()
.option(
"-n, --name <name:string>",
"Specify the name.This is required.",
{ required: true },
)
.option(
"-H, --headers <headers:string>",
Expand Down
10 changes: 9 additions & 1 deletion libs/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ export class InitAction {

export class InstallAction {
async execute(
options: { postProcesses?: string[]; name: string; headers?: string[] },
options: {
postProcesses?: string[];
name?: string;
headers?: string[];
},
url: string | undefined,
) {
await createDataFilesDir();
Expand All @@ -173,6 +177,10 @@ export class InstallAction {
}
const parsedHeaders: Record<string, string> = parseHeader(options.headers);
if (url !== undefined) {
if (options.name === undefined) {
console.log(Colors.red("The -n option is not specified."));
Deno.exit(1);
}
const targetContent = new DimFileAccessor().getContents().find((c) =>
c.name === options.name
);
Expand Down

0 comments on commit bedbb61

Please sign in to comment.