Yay!
I decided to modernize the appearance of my copy/move commands...
It's sooooooooooooooo much easier for me to see where one name starts and another name ends, when each line is a different color and prefixed with an emoji:
Double-height/blinking/reverse/stop-sign-emoji'ed errors grab my attention better, especially if my text is zoomed to a small size:
Everything is achieved via a python postprocessing script copy-move-post.py (attached).
Just redefine your move/copy commands to pass through copy-move-post.py:
Here is what copy-move-post.py looks like:
P.S. Unimportant, but I also changed the "append" arrow ("=>>") to an emoji arrow I find more pleasing in Windows Terminal:
I decided to modernize the appearance of my copy/move commands...
- Each line is a unique color & begins with an appropriate emoji
- Errors and footers are double-height & blink
- Errors are underlined
- Prompts have random background coors
- File-counts are double-underlined
It's sooooooooooooooo much easier for me to see where one name starts and another name ends, when each line is a different color and prefixed with an emoji:
Double-height/blinking/reverse/stop-sign-emoji'ed errors grab my attention better, especially if my text is zoomed to a small size:
Everything is achieved via a python postprocessing script copy-move-post.py (attached).
Just redefine your move/copy commands to pass through copy-move-post.py:
Code:
alias copy=*copy %* |& copy-move-post.py
alias move=*move %* |& copy-move-post.py
Here is what copy-move-post.py looks like:
Code:
import random
import sys
import re
from colorama import init
init(autoreset=False)
FOOTERS = ["files copied","files moved","file copied","file moved"]
MIN_RGB_VALUE_FG = 42; MAX_RGB_VALUE_FG = 255
MIN_RGB_VALUE_BG = 16; MAX_RGB_VALUE_BG = 64
def get_random_color(bg=False):
if bg: min_rgb_value = MIN_RGB_VALUE_BG; max_rgb_value = MAX_RGB_VALUE_BG
else: min_rgb_value = MIN_RGB_VALUE_FG; max_rgb_value = MAX_RGB_VALUE_FG
return random.randint(min_rgb_value,max_rgb_value), \
random.randint(min_rgb_value,max_rgb_value), \
random.randint(min_rgb_value,max_rgb_value)
def enclose_numbers(line): return re.sub(r'(\d+)', r'\033[21m\1\033[24m', line) # ansi-stylize numbers - italics + double-underline
def print_line(line_buffer, r, g, b, additional_beginning_ansi=""):
double = False # double height or not?
summary = False # copy/mv summary line?
if any(substring in line_buffer for substring in FOOTERS):
line_buffer = enclose_numbers(line_buffer)
double = True
summary = True
line = f'\033[93m' # i like my arrow yellow
if any(substring in line_buffer for substring in ["=>","->"]): line += f'⭢︋ ' # emojis at beginning of filename lines
if any(substring in line_buffer for substring in ["Y/N/A/R"]): line += f'❓❓ ' # emojis at beginning of prompty lines
elif any(substring in line_buffer for substring in ["TCC: (Sys)"]):
double = True; line += f'\033[6m\033[3m\033[4m\033[7m' # emojis at beginning of error lines during copying
elif summary: line += f'✔️' # emojis at beginning of summary lines of how many files copied
else: line += f' ' # normal lines get prefixed with this
line += f'\033[38;2;{r};{g};{b}m{additional_beginning_ansi}{line_buffer.rstrip()}\033[0m\n' # print line in our random-RGB color
line = line.replace("=>>","↪️") #.replace("=>","⭢︋")
if not double: sys.stdout.write(line) # normal height line
else: sys.stdout.write(f'\033#3{line}\033#4{line}') # double height line
################################################################################################################################################################
line_buffer = ""
in_prompt = False
additional_beginning_ansi = ""
r, g, b = get_random_color()
while True: # It's tempting to process things line-by-line, but due to prompts and such, we must process things char-by-char
char = sys.stdin.read(1)
if not char: break
line_buffer += char
if char == '?' and not in_prompt:
in_prompt = True
bgr, bgg, bgb = get_random_color(bg=True) # Reset for the next line
r , g, b = get_random_color() # Reset for the next line
#ys.stdout.write(f'\033[38;2;{r};{g};{b}m{additional_beginning_ansi}❓❓ \033[6m{line_buffer}\033[0m ') #\033[1C
#ys.stdout.write(f'\033[48;2;{r};{g};{b}m{additional_beginning_ansi}❓❓ \033[6m{line_buffer}\033[0m ') #\033[1C
sys.stdout.write(f'\033[48;2;{bgr};{bgg};{bgb}m\033[38;2;{r};{g};{b}m{additional_beginning_ansi}❓❓ \033[6m{line_buffer} ') #\033[0m #\033[1C
sys.stdout.flush() # Flush the output buffer to display the prompt immediately
line_buffer = ""
elif in_prompt and char == '\n':
in_prompt = False
sys.stdout.write(f'\033[1D{line_buffer.rstrip()}\033[0m\n')
line_buffer = ""
elif char == '\n':
if any(substring in line_buffer for substring in FOOTERS): additional_beginning_ansi += "\033[6m" # make it blink
print_line(line_buffer, r, g, b, additional_beginning_ansi)
line_buffer = "" # Reset for the next line
additional_beginning_ansi = "" # Reset for the next line
r, g, b = get_random_color() # Reset for the next line
P.S. Unimportant, but I also changed the "append" arrow ("=>>") to an emoji arrow I find more pleasing in Windows Terminal:
Last edited: