Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
root authored and root committed May 26, 2023
1 parent 31a9ae7 commit 4478d09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ await new Command()
)
.option(
"-P, --pageInstall <pageInstall:string>",
"Execute install from links in specified page."
"Execute install from links in specified page.",
)
.option(
"-e, --expression <expression:string>",
"Filter PageInstall result by regular expression."
"Filter PageInstall result by regular expression.",
)
.description(
"Install the data.\n" +
Expand Down
11 changes: 5 additions & 6 deletions libs/actions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Colors, Confirm, Input, DOMParser } from "../deps.ts";
import { Colors, Confirm, DOMParser, Input } from "../deps.ts";
import { DEFAULT_DATAFILES_PATH, DEFAULT_DIM_FILE_PATH } from "./consts.ts";
import { DimFileAccessor, DimLockFileAccessor } from "./accessor.ts";
import { CkanApiClient } from "./ckan_api_client.ts";
Expand Down Expand Up @@ -51,26 +51,25 @@ export class InstallAction {
const re = new RegExp(options.expression, "ig");
let href = new URL(
link.getAttribute("href"),
options.pageInstall
options.pageInstall,
).toString();
if (re.test(href)) {
idx += 1;
let dataName = "";
if (options.name !== undefined) {
dataName =
options.name + "/" + idx.toString() + "_" + link.textContent;
dataName = options.name + "/" + idx.toString() + "_" + link.textContent;
} else {
dataName = idx.toString() + "_" + link.textContent;
}
const fullPath = await installFromURL(
href,
dataName,
options.postProcesses,
parsedHeaders
parsedHeaders,
).catch((error) => {
console.error(
Colors.red("Failed to install."),
Colors.red(error.message)
Colors.red(error.message),
);
Deno.exit(1);
});
Expand Down

0 comments on commit 4478d09

Please sign in to comment.