mirror of
https://github.com/sharkdp/bat.git
synced 2025-02-07 13:41:14 +00:00
Updated creation script and README to match generation script
This commit is contained in:
parent
f3c760c25f
commit
6c68198d19
@ -23,9 +23,14 @@ SKIP_FILENAMES = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def get_extra_options(source):
|
def get_options(source):
|
||||||
with open(path.join(source, "bat_options"), "r") as f:
|
source_dirpath = path.dirname(source)
|
||||||
return list(map(lambda x: x.rstrip(), f.readlines()))
|
options = BAT_OPTIONS.copy()
|
||||||
|
if path.exists(path.join(source_dirpath, "bat_options")):
|
||||||
|
with open(path.join(source, "bat_options"), "r") as f:
|
||||||
|
options += list(map(lambda x: x.rstrip(), f.readlines()))
|
||||||
|
return options
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def create_highlighted_versions(output_basepath):
|
def create_highlighted_versions(output_basepath):
|
||||||
@ -42,20 +47,14 @@ def create_highlighted_versions(output_basepath):
|
|||||||
env.pop("BAT_TABS", None)
|
env.pop("BAT_TABS", None)
|
||||||
env["COLORTERM"] = "truecolor" # make sure to output 24bit colors
|
env["COLORTERM"] = "truecolor" # make sure to output 24bit colors
|
||||||
|
|
||||||
source_dirpath = path.dirname(source)
|
source_dirname = path.basename(path.dirname(source))
|
||||||
source_dirname = path.basename(source_dirpath)
|
|
||||||
source_filename = path.basename(source)
|
source_filename = path.basename(source)
|
||||||
|
|
||||||
if source_filename in SKIP_FILENAMES:
|
if source_filename in SKIP_FILENAMES:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
options = BAT_OPTIONS.copy()
|
|
||||||
# If a directory is empty, `files` could possibly be 0-length
|
|
||||||
if path.exists(path.join(source_dirpath, "bat_options")):
|
|
||||||
options += get_extra_options(source_dirpath)
|
|
||||||
|
|
||||||
bat_output = subprocess.check_output(
|
bat_output = subprocess.check_output(
|
||||||
["bat"] + options + [source],
|
["bat"] + get_options(source) + [source],
|
||||||
stderr=subprocess.PIPE, env=env,
|
stderr=subprocess.PIPE, env=env,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
This text file was generated with the following script. Certain invalid characters were removed manually:
|
This text file was generated with the following script.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
with open("plaintext.txt", "w"):
|
with open("plaintext.txt", "w"):
|
||||||
for i in range(0x10FFFF):
|
for i in range(176):
|
||||||
try:
|
try:
|
||||||
f.write(chr(i) + "\n")
|
f.write(chr(i) + "\n")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
f.write("\n")
|
||||||
|
f.write("Here is a line with multiple characters")
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user