mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-26 05:47:32 +00:00
commit
26b40bf773
@ -19,12 +19,12 @@ _exa()
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
-t|--time)
|
-t|--time)
|
||||||
COMPREPLY=( $( compgen -W 'modified changed accessed created --' -- $cur ) )
|
COMPREPLY=( $( compgen -W 'modified changed accessed created --' -- "$cur" ) )
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--time-style)
|
--time-style)
|
||||||
COMPREPLY=( $( compgen -W 'default iso long-iso full-iso --' -- $cur ) )
|
COMPREPLY=( $( compgen -W 'default iso long-iso full-iso --' -- "$cur" ) )
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#compdef exa
|
#compdef exa
|
||||||
|
|
||||||
# Save this file as _exa in /usr/local/share/zsh/site-functions or in any
|
# Save this file as _exa in /usr/local/share/zsh/site-functions or in any
|
||||||
# other folder in $fpath. E. g. save it in a folder called ~/.zfunc and add a
|
# other folder in $fpath. E.g. save it in a folder called ~/.zfunc and add a
|
||||||
# line containing `fpath=(~/.zfunc $fpath)` somewhere before `compinit` in your
|
# line containing `fpath=(~/.zfunc $fpath)` somewhere before `compinit` in your
|
||||||
# ~/.zshrc.
|
# ~/.zshrc.
|
||||||
|
|
||||||
|
@ -11,17 +11,17 @@ bash /vagrant/devtools/dev-versions.sh
|
|||||||
# Configure the Cool Prompt™ (not actually trademarked).
|
# Configure the Cool Prompt™ (not actually trademarked).
|
||||||
# The Cool Prompt tells you whether you’re in debug or strict mode, whether
|
# The Cool Prompt tells you whether you’re in debug or strict mode, whether
|
||||||
# you have colours configured, and whether your last command failed.
|
# you have colours configured, and whether your last command failed.
|
||||||
function nonzero_return() { RETVAL=$?; [ $RETVAL -ne 0 ] && echo "$RETVAL "; }
|
nonzero_return() { RETVAL=$?; [ "$RETVAL" -ne 0 ] && echo "$RETVAL "; }
|
||||||
function debug_mode() { [ "$EXA_DEBUG" == "trace" ] && echo -n "trace-"; [ -n "$EXA_DEBUG" ] && echo "debug "; }
|
debug_mode() { [ "$EXA_DEBUG" == "trace" ] && echo -n "trace-"; [ -n "$EXA_DEBUG" ] && echo "debug "; }
|
||||||
function strict_mode() { [ -n "$EXA_STRICT" ] && echo "strict "; }
|
strict_mode() { [ -n "$EXA_STRICT" ] && echo "strict "; }
|
||||||
function lsc_mode() { [ -n "$LS_COLORS" ] && echo "lsc "; }
|
lsc_mode() { [ -n "$LS_COLORS" ] && echo "lsc "; }
|
||||||
function exac_mode() { [ -n "$EXA_COLORS" ] && echo "exac "; }
|
exac_mode() { [ -n "$EXA_COLORS" ] && echo "exac "; }
|
||||||
export PS1="\[\e[1;36m\]\h \[\e[32m\]\w \[\e[31m\]\`nonzero_return\`\[\e[35m\]\`debug_mode\`\[\e[32m\]\`lsc_mode\`\[\e[1;32m\]\`exac_mode\`\[\e[33m\]\`strict_mode\`\[\e[36m\]\\$\[\e[0m\] "
|
export PS1="\[\e[1;36m\]\h \[\e[32m\]\w \[\e[31m\]\`nonzero_return\`\[\e[35m\]\`debug_mode\`\[\e[32m\]\`lsc_mode\`\[\e[1;32m\]\`exac_mode\`\[\e[33m\]\`strict_mode\`\[\e[36m\]\\$\[\e[0m\] "
|
||||||
|
|
||||||
|
|
||||||
# The ‘debug’ function lets you switch debug mode on and off.
|
# The ‘debug’ function lets you switch debug mode on and off.
|
||||||
# Turn it on if you need to see exa’s debugging logs.
|
# Turn it on if you need to see exa’s debugging logs.
|
||||||
function debug () {
|
debug() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
""|"on") export EXA_DEBUG=1 ;;
|
""|"on") export EXA_DEBUG=1 ;;
|
||||||
"off") export EXA_DEBUG= ;;
|
"off") export EXA_DEBUG= ;;
|
||||||
@ -33,11 +33,12 @@ function debug () {
|
|||||||
|
|
||||||
# The ‘strict’ function lets you switch strict mode on and off.
|
# The ‘strict’ function lets you switch strict mode on and off.
|
||||||
# Turn it on if you’d like exa’s command-line arguments checked.
|
# Turn it on if you’d like exa’s command-line arguments checked.
|
||||||
function strict () {
|
strict() {
|
||||||
case "$1" in "on") export EXA_STRICT=1 ;;
|
case "$1" in
|
||||||
|
"on") export EXA_STRICT=1 ;;
|
||||||
"off") export EXA_STRICT= ;;
|
"off") export EXA_STRICT= ;;
|
||||||
"") [ -n "$EXA_STRICT" ] && echo "strict on" || echo "strict off" ;;
|
"") [ -n "$EXA_STRICT" ] && echo "strict on" || echo "strict off" ;;
|
||||||
*) echo "Usage: strict on|off"; return 1 ;;
|
*) echo "Usage: strict on|off"; return 1 ;;
|
||||||
esac;
|
esac;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ function strict () {
|
|||||||
# environment variables. There’s also a ‘hacker’ theme which turns everything
|
# environment variables. There’s also a ‘hacker’ theme which turns everything
|
||||||
# green, which is usually used for checking that all colour codes work, and
|
# green, which is usually used for checking that all colour codes work, and
|
||||||
# for looking cool while you phreak some mainframes or whatever.
|
# for looking cool while you phreak some mainframes or whatever.
|
||||||
function colors () {
|
colors() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"ls")
|
"ls")
|
||||||
export LS_COLORS="di=34:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43"
|
export LS_COLORS="di=34:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43"
|
||||||
|
@ -9,7 +9,7 @@ set -e
|
|||||||
|
|
||||||
|
|
||||||
# Linux check!
|
# Linux check!
|
||||||
uname=`uname -s`
|
uname=$(uname -s)
|
||||||
if [[ "$uname" != "Linux" ]]; then
|
if [[ "$uname" != "Linux" ]]; then
|
||||||
echo "Gotta be on Linux to run this (detected '$uname')!"
|
echo "Gotta be on Linux to run this (detected '$uname')!"
|
||||||
exit 1
|
exit 1
|
||||||
@ -29,8 +29,8 @@ fi
|
|||||||
|
|
||||||
# Weekly builds have a bit more information in their version number (see build.rs).
|
# Weekly builds have a bit more information in their version number (see build.rs).
|
||||||
if [[ "$1" == "--weekly" ]]; then
|
if [[ "$1" == "--weekly" ]]; then
|
||||||
git_hash=`GIT_DIR=/vagrant/.git git rev-parse --short --verify HEAD`
|
git_hash=$(GIT_DIR=/vagrant/.git git rev-parse --short --verify HEAD)
|
||||||
date=`date +"%Y-%m-%d"`
|
date=$(date +"%Y-%m-%d")
|
||||||
echo "Building exa weekly v$exa_version, date $date, Git hash $git_hash"
|
echo "Building exa weekly v$exa_version, date $date, Git hash $git_hash"
|
||||||
else
|
else
|
||||||
echo "Building exa v$exa_version"
|
echo "Building exa v$exa_version"
|
||||||
@ -57,9 +57,10 @@ strip -v "$exa_linux_binary"
|
|||||||
# the binaries can have consistent names, and it’s still possible to tell
|
# the binaries can have consistent names, and it’s still possible to tell
|
||||||
# different *downloads* apart.
|
# different *downloads* apart.
|
||||||
echo -e "\n\033[4mZipping binary...\033[0m"
|
echo -e "\n\033[4mZipping binary...\033[0m"
|
||||||
if [[ "$1" == "--weekly" ]]
|
if [[ "$1" == "--weekly" ]]; then
|
||||||
then exa_linux_zip="/vagrant/exa-linux-x86_64-${exa_version}-${date}-${git_hash}.zip"
|
exa_linux_zip="/vagrant/exa-linux-x86_64-${exa_version}-${date}-${git_hash}.zip"
|
||||||
else exa_linux_zip="/vagrant/exa-linux-x86_64.zip"
|
else
|
||||||
|
exa_linux_zip="/vagrant/exa-linux-x86_64.zip"
|
||||||
fi
|
fi
|
||||||
rm -vf "$exa_linux_zip"
|
rm -vf "$exa_linux_zip"
|
||||||
zip -j "$exa_linux_zip" "$exa_linux_binary"
|
zip -j "$exa_linux_zip" "$exa_linux_binary"
|
||||||
|
@ -11,7 +11,7 @@ set -e
|
|||||||
|
|
||||||
# Virtualising macOS is a legal minefield, so this script is ‘local’ instead
|
# Virtualising macOS is a legal minefield, so this script is ‘local’ instead
|
||||||
# of ‘dev’: I run it from my actual machine, rather than from a VM.
|
# of ‘dev’: I run it from my actual machine, rather than from a VM.
|
||||||
uname=`uname -s`
|
uname=$(uname -s)
|
||||||
if [[ "$uname" != "Darwin" ]]; then
|
if [[ "$uname" != "Darwin" ]]; then
|
||||||
echo "Gotta be on Darwin to run this (detected '$uname')!"
|
echo "Gotta be on Darwin to run this (detected '$uname')!"
|
||||||
exit 1
|
exit 1
|
||||||
@ -36,8 +36,8 @@ fi
|
|||||||
|
|
||||||
# Weekly builds have a bit more information in their version number (see build.rs).
|
# Weekly builds have a bit more information in their version number (see build.rs).
|
||||||
if [[ "$1" == "--weekly" ]]; then
|
if [[ "$1" == "--weekly" ]]; then
|
||||||
git_hash=`GIT_DIR=$exa_root/.git git rev-parse --short --verify HEAD`
|
git_hash=$(GIT_DIR=$exa_root/.git git rev-parse --short --verify HEAD)
|
||||||
date=`date +"%Y-%m-%d"`
|
date=$(date +"%Y-%m-%d")
|
||||||
echo "Building exa weekly v$exa_version, date $date, Git hash $git_hash"
|
echo "Building exa weekly v$exa_version, date $date, Git hash $git_hash"
|
||||||
else
|
else
|
||||||
echo "Building exa v$exa_version"
|
echo "Building exa v$exa_version"
|
||||||
@ -65,9 +65,10 @@ echo "strip $exa_macos_binary"
|
|||||||
# the binaries can have consistent names, and it’s still possible to tell
|
# the binaries can have consistent names, and it’s still possible to tell
|
||||||
# different *downloads* apart.
|
# different *downloads* apart.
|
||||||
echo -e "\n\033[4mZipping binary...\033[0m"
|
echo -e "\n\033[4mZipping binary...\033[0m"
|
||||||
if [[ "$1" == "--weekly" ]]
|
if [[ "$1" == "--weekly" ]]; then
|
||||||
then exa_macos_zip="$exa_root/exa-macos-x86_64-${exa_version}-${date}-${git_hash}.zip"
|
exa_macos_zip="$exa_root/exa-macos-x86_64-${exa_version}-${date}-${git_hash}.zip"
|
||||||
else exa_macos_zip="$exa_root/exa-macos-x86_64-${exa_version}.zip"
|
else
|
||||||
|
exa_macos_zip="$exa_root/exa-macos-x86_64-${exa_version}.zip"
|
||||||
fi
|
fi
|
||||||
rm -vf "$exa_macos_zip" | sed 's/^/removing /'
|
rm -vf "$exa_macos_zip" | sed 's/^/removing /'
|
||||||
zip -j "$exa_macos_zip" "$exa_macos_binary"
|
zip -j "$exa_macos_zip" "$exa_macos_binary"
|
||||||
|
@ -158,7 +158,7 @@ impl<'a> Render<'a> {
|
|||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let mut last_working_grid = self.make_grid(1, options, &file_names, rows.clone(), &drender);
|
let mut last_working_grid = self.make_grid(1, options, &file_names, rows.clone(), &drender);
|
||||||
|
|
||||||
if file_names.len() == 1 {
|
if file_names.len() == 1 {
|
||||||
return Some((last_working_grid, 1));
|
return Some((last_working_grid, 1));
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ impl<'a> Render<'a> {
|
|||||||
if the_grid_fits {
|
if the_grid_fits {
|
||||||
last_working_grid = grid;
|
last_working_grid = grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !the_grid_fits || column_count == file_names.len() {
|
if !the_grid_fits || column_count == file_names.len() {
|
||||||
let last_column_count = if the_grid_fits { column_count } else { column_count - 1 };
|
let last_column_count = if the_grid_fits { column_count } else { column_count - 1 };
|
||||||
// If we’ve figured out how many columns can fit in the user’s terminal,
|
// If we’ve figured out how many columns can fit in the user’s terminal,
|
||||||
|
@ -46,7 +46,7 @@ impl f::Size {
|
|||||||
} else {
|
} else {
|
||||||
numerics.format_int(n.round() as isize)
|
numerics.format_int(n.round() as isize)
|
||||||
};
|
};
|
||||||
|
|
||||||
TextCell {
|
TextCell {
|
||||||
// symbol is guaranteed to be ASCII since unit prefixes are hardcoded.
|
// symbol is guaranteed to be ASCII since unit prefixes are hardcoded.
|
||||||
width: DisplayWidth::from(&*number) + symbol.len(),
|
width: DisplayWidth::from(&*number) + symbol.len(),
|
||||||
|
Loading…
Reference in New Issue
Block a user