Skip to content

Commit

Permalink
feat: add is_interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
Qu4k committed Aug 25, 2020
1 parent d0fe042 commit 0554bb7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions is_interactive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export function isInteractive(stream: { rid: number }): boolean {
if (Deno.permissions.query({ name: "env" })) {
return (
Deno.isatty(stream.rid) &&
Deno.env.get("TERM") !== "dumb" &&
!Deno.env.get("CI")
);
}
return Deno.isatty(stream.rid);
}
1 change: 1 addition & 0 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ export * from "./tty_sync.ts";
export * from "./wcwidth.ts";
export * from "./ansi_regex.ts";
export * from "./strip_ansi.ts";
export * from "./is_interactive.ts";

0 comments on commit 0554bb7

Please sign in to comment.