mirror of
https://github.com/sharkdp/bat.git
synced 2025-01-31 10:11:07 +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):
|
||||
with open(path.join(source, "bat_options"), "r") as f:
|
||||
return list(map(lambda x: x.rstrip(), f.readlines()))
|
||||
def get_options(source):
|
||||
source_dirpath = path.dirname(source)
|
||||
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):
|
||||
@ -42,20 +47,14 @@ def create_highlighted_versions(output_basepath):
|
||||
env.pop("BAT_TABS", None)
|
||||
env["COLORTERM"] = "truecolor" # make sure to output 24bit colors
|
||||
|
||||
source_dirpath = path.dirname(source)
|
||||
source_dirname = path.basename(source_dirpath)
|
||||
source_dirname = path.basename(path.dirname(source))
|
||||
source_filename = path.basename(source)
|
||||
|
||||
if source_filename in SKIP_FILENAMES:
|
||||
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"] + options + [source],
|
||||
["bat"] + get_options(source) + [source],
|
||||
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
|
||||
with open("plaintext.txt", "w"):
|
||||
for i in range(0x10FFFF):
|
||||
for i in range(176):
|
||||
try:
|
||||
f.write(chr(i) + "\n")
|
||||
except:
|
||||
pass
|
||||
f.write("\n")
|
||||
f.write("Here is a line with multiple characters")
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user