-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
78 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
"CMYB", | ||
"dinject", | ||
"epilog", | ||
"fstat", | ||
"naughtty", | ||
"RGBA", | ||
"Strikethrough" | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from os import fstat | ||
|
||
|
||
def should_emit_codes() -> bool: | ||
"""Returns `True` if ANSI escape codes should be emitted.""" | ||
|
||
return fstat(0) == fstat(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Checks | ||
|
||
`ansiscape.checks` contains functions to check the state of your application. | ||
|
||
`should_emit_codes()` returns `True` if ANSI escape codes should be emitted. It'll return `False`, for example, if the script appears to be running non-interactively. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ markdown_extensions: | |
nav: | ||
- index.md | ||
- cli.md | ||
- checks.md | ||
- make.md | ||
- read.md | ||
- interpretation.md | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
assert() { | ||
if [[ "${1}" == "${2}" ]]; then | ||
return | ||
fi | ||
|
||
echo "Expected \"${2}\" but got \"${1}\" 🔥" | ||
exit 1 | ||
} | ||
|
||
assert "$(ansiscape --version)" "${CIRCLE_TAG:-"-1.-1.-1"}" | ||
assert "$(ansiscape --check)" "no" | ||
assert "$(naughtty ansiscape --check)" $'yes\r' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from ansiscape.checks import should_emit_codes | ||
|
||
|
||
def test_should_emit_codes() -> None: | ||
assert not should_emit_codes() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters