Skip to content

Commit

Permalink
chore: Change cli.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
redpeacock78 committed Nov 12, 2021
1 parent c31582b commit 29e428e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cli.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { readAllSync } from "https://deno.land/[email protected]/streams/conversion.ts";
import { getStdinBufferSync } from "https://deno.land/x/[email protected]/mod.ts";
import { Command } from "https://deno.land/x/[email protected]/command/mod.ts";
import { base85encode, base85decode } from "./mod.ts";
Expand All @@ -15,15 +16,15 @@ try {
args_judge = Deno.args[0].match(/-d|--decode|-h|--help|-V|--version/) ? true : false;
if (!args_judge) {
try {
file = Deno.readAllSync(Deno.openSync(Deno.args[0]));
file = readAllSync(Deno.openSync(Deno.args[0]));
Deno.close(Deno.openSync(Deno.args[0]).rid);
filled = file.length !== 0 ? true : false;
} catch {
throw new Error("base85: No such file or directory");
}
} else if (Deno.args[1]) {
try {
file = Deno.readAllSync(Deno.openSync(Deno.args[1]));
file = readAllSync(Deno.openSync(Deno.args[1]));
Deno.close(Deno.openSync(Deno.args[1]).rid);
filled = file.length !== 0 ? true : false;
} catch {
Expand All @@ -34,7 +35,7 @@ try {
const { options, args } = await new Command()
.name("base85")
.description("Base85 (Ascii85 with Adobe Escape Sequence) encode or decode FILE, or standard input, to standard output.")
.version("0.0.9")
.version("0.0.10")
.option("-d, --decode", "Decode data")
.arguments("<option>")
.parse(!isatty ? [...Deno.args, [...stdin!].join(",")] : !file! ? Deno.args : !args_judge! ? [[...file!].join(",")] : [Deno.args[0], [...file!].join(",")]);
Expand Down

0 comments on commit 29e428e

Please sign in to comment.