mysrc /a/bin/small-misc-bash/ll-function
mysrc /a/bin/distro-functions/src/package-manager-abstractions
mysrc /a/bin/fai/fai/config/distro-install-common/bash-misc-funcs
-mysrc /a/c/fzf-brc
-o -name .undo-tree-history -prune \) \! -type d 2>/dev/null
}
+# like faf, but sort by modification time. like lt()
+faft() {
+ find "$@" -not \( -name .svn -prune -o -name .git -prune \
+ -o -name .hg -prune -o -name .editor-backups -prune \
+ -o -name .undo-tree-history -prune \) \! -type d \
+ -printf "%T@ %P\n" | sort -n | cut -d' ' -f2-
+}
+
# ffmpeg concat files.
# usage ffconcat FILES_TO_CONCAT OUTPUT_FILE
ffconcat() {
# sets $host_type, and maybe some related vars: $pre_synced, $extra_info
_sl-get-host-type() {
- local tmp tmp2 testbool testcmd
- local -a tmpa
+ local f tmp tmp2 testbool testcmd
+
if [[ $sl_local_test_cmd ]]; then
host_type=$($sl_local_test_cmd "$remote")
+ if [[ $host_type == skip ]]; then return; fi
fi
- if [[ $host_type ]]; then return; fi
- tmpa=($SL_INFO_DIR/??????????-????-"$remote")
- sshinfo=${tmpa[0]}
+ sshinfo_files=($SL_INFO_DIR/??????????-????-"$remote")
+ # there should only be one, but just in case, remove all but 1.
+ if (( ${#sshinfo_files[@]} >= 2 )); then
+ mq rm ${sshinfo_files[@]::${#sshinfo_files[@]}-1}
+ sshinfo_files=($SL_INFO_DIR/??????????-????-"$remote")
+ fi
+ sshinfo="${sshinfo_files[0]}"
+
+ # if $verbose; then e "sshinfo: '$sshinfo'"; fi # debug
if [[ -e $sshinfo ]]; then
- tmp=${sshinfo[0]##*/}
+ tmp=${sshinfo##*/}
tmp2=${tmp:11} # skip 11 chars
- host_type=${tmp2%%-*}
+ if [[ ! $host_type ]]; then
+ host_type=${tmp2%%-*}
+ fi
+ if [[ $host_type == skip ]]; then return; fi
extra_info=$(cat $sshinfo)
### block to see if past sync is up to date
# SL_TEST_CMD / --sl-test-cmd CMD: Env var or cli option. If set, we run
# this string on the remote host the first time sl is run (or if we run
-# slr). Its standard out is passed to SL_TEST_HOOK which gets run
-# locally. It is meant to be used to vary the files synced depending on
-# the remote host. For example, export SL_TEST_CMD=". /etc/os-release ;
-# echo \${VERSION//[^a-zA-Z0-9]/}". cli option overrides env var.
+# slr) and there is no SL_LOCAL_TEST_CMD. Its standard out is passed to
+# SL_TEST_HOOK which gets run locally. It is meant to be used to vary
+# the files synced depending on the remote host. For example, export
+# SL_TEST_CMD=". /etc/os-release ; echo \${VERSION//[^a-zA-Z0-9]/}". cli
+# option overrides env var. The internal var is "extra_info".
# SL_TEST_HOOK / --sl-test-hook HOOK: Env var or cli option. See SL_TEST_CMD
# above. It is run unquoted (with expansion). This can set $SL_FILES_DIR
local verbose now args remote sshinfo tmp host_type info_sec force_rsync
local sync_dirname extra_info files_sec sl_test_cmd sl_test_hook pre_synced
local sl_rsync_cmd sl_test_cmd sl_test_hook sl_local_test_cmd
- local -a args
+ local -a args sshinfo_files
args=($SL_SSH_ARGS)
esac
shift
done
+ # verbose=true # debug
while [[ $1 ]]; do
case "$1" in
pre_synced=false
_sl-get-host-type
- if [[ $sl_test_hook ]]; then
+ if [[ $sl_test_hook && $extra_info ]]; then
mq RSYNC_RSH="ssh ${args[*]}" $sl_test_hook "$extra_info" "$remote"
fi
if [[ $host_type == sync ]] && ! $pre_synced; then
m RSYNC_RSH="ssh ${args[*]}" $sl_rsync_cmd -rptL --delete $SL_FILES_DIR "$remote":
-
+ mq rm-maybe "$sshinfo"
sshinfo=$SL_INFO_DIR/$EPOCHSECONDS-$host_type-"$remote"
[[ -e $SL_INFO_DIR ]] || mkdir -p $SL_INFO_DIR
printf "%s\n" "$extra_info" >$sshinfo
chmod 666 $sshinfo
+ if $verbose; then
+ m ls -la $sshinfo
+ fi
fi
if [[ $host_type == sync ]]; then
fi
fi
+# in fzf-brc, _fzf_handle_dynamic_completion is returning 1.
+err_catch_ignore+=( '*/fzf-brc' )
+mysrc /a/c/fzf-brc
# ensure no bad programs appending to this file will have an affect
return 0
+++ /dev/null
-#!/bin/bash
-# I, Ian Kelling, follow the GNU license recommendations at
-# https://www.gnu.org/licenses/license-recommendations.en.html. They
-# recommend that small programs, < 300 lines, be licensed under the
-# Apache License 2.0. This file contains or is part of one or more small
-# programs. If a small program grows beyond 300 lines, I plan to change
-# to a recommended GPL license.
-
-# Copyright 2024 Ian Kelling
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-# http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-printf "%s" "$*" >> /tmp/ikclip.log
-# both!
-printf "%s" "$*" | xclip
-printf "%s" "$*" | xclip -selection clipboard