mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-25 14:05:41 -05:00
6265ef91d5
To make sure that all error and information reporting to the user is unified, all instances of `print!`, `eprint!`, `println!` and `eprintln!` have been removed and replaced by logging. When `RUST_LOG` is not specified, the default Alacritty logger now also prints to both the stderr and a log file. The log file is only created when a message is written to it and its name is printed to stdout the first time it is used. Whenever a warning or an error has been written to the log file/stderr, a message is now displayed in Alacritty which points to the log file where the full error is documented. The message is cleared whenever the screen is cleared using either the `clear` command or the `Ctrl+L` key binding. To make sure that log files created by root don't prevent normal users from interacting with them, the Alacritty log file is `/tmp/Alacritty-$PID.log`. Since it's still possible that the log file can't be created, the UI error/warning message now informs the user if the message was only written to stderr. The reason why it couldn't be created is then printed to stderr. To make sure the deletion of the log file at runtime doesn't create any issues, the file is re-created if a write is attempted without the file being present. To help with debugging Alacritty issues, a timestamp and the error level are printed in all log messages. All log messages now follow this format: [YYYY-MM-DD HH:MM] [LEVEL] Message Since it's not unusual to spawn a lot of different terminal emulators without restarting, Alacritty can create a ton of different log files. To combat this problem, logfiles are removed by default after Alacritty has been closed. If the user wants to persist the log of a single session, the `--persistent_logging` option can be used. For persisting all log files, the `persistent_logging` option can be set in the configuration file
57 lines
1.7 KiB
Bash
57 lines
1.7 KiB
Bash
#/usr/bin/env bash
|
|
|
|
# Load completion function
|
|
complete -F _alacritty alacritty
|
|
|
|
# Completion function
|
|
_alacritty()
|
|
{
|
|
local cur prev prevprev opts
|
|
COMPREPLY=()
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
prevprev="${COMP_WORDS[COMP_CWORD-2]}"
|
|
opts="-h --help -V --version --live-config-reload --no-live-config-reload --persistent-logging --print-events -q -qq -v -vv -vvv --ref-test -e --command --config-file -d --dimensions -t --title --working-directory"
|
|
|
|
# If `--command` or `-e` is used, stop completing
|
|
for i in "${!COMP_WORDS[@]}"; do
|
|
if [[ "${COMP_WORDS[i]}" == "--command" ]] \
|
|
|| [[ "${COMP_WORDS[i]}" == "-e" ]] \
|
|
&& [[ "${#COMP_WORDS[@]}" -gt "$(($i + 2))" ]]
|
|
then
|
|
return 0
|
|
fi
|
|
done
|
|
|
|
# Make sure the Y dimension isn't completed
|
|
if [[ "${prevprev}" == "--dimensions" ]] || [[ "${prevprev}" == "-d" ]]; then
|
|
return 0
|
|
fi
|
|
|
|
# Match the previous word
|
|
case "${prev}" in
|
|
--command | -e)
|
|
# Complete all commands in $PATH
|
|
COMPREPLY=( $(compgen -c -- "${cur}") )
|
|
return 0;;
|
|
--config-file)
|
|
# Path based completion
|
|
local IFS=$'\n'
|
|
compopt -o filenames
|
|
COMPREPLY=( $(compgen -f -- "${cur}") )
|
|
return 0;;
|
|
--dimensions | -d | --title | -t)
|
|
# Don't complete here
|
|
return 0;;
|
|
--working-directory)
|
|
# Directory completion
|
|
local IFS=$'\n'
|
|
compopt -o filenames
|
|
COMPREPLY=( $(compgen -d -- "${cur}") )
|
|
return 0;;
|
|
esac
|
|
|
|
# Show all flags if there was no previous word
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
return 0
|
|
}
|