From 7cb654e31e5ecc2eff6795928cb7fce416c60fdb Mon Sep 17 00:00:00 2001 From: Pablo Olmos de Aguilera Corradini Date: Sat, 22 Feb 2014 13:16:51 -0300 Subject: Add sigil (`$`) for symlinked dir for lsrc -F The `$` sigil in `-F` indicates that the directory is symlinked instead of recurred upon. Fixes #37. --- bin/lsrc | 10 +++++++++- man/lsrc.1 | 17 +++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/bin/lsrc b/bin/lsrc index d8a36b5..d78b0ad 100755 --- a/bin/lsrc +++ b/bin/lsrc @@ -71,7 +71,9 @@ show_dir() { sigil_for() { local file=$1 + local symlink_dirs_file_globs=$2 local copy_always=0 + local symlink_dirs=0 for copy_file in $COPY_ALWAYS; do $DEBUG "copy_file: $copy_file" @@ -85,8 +87,14 @@ sigil_for() { esac done + if [ -n "$symlink_dirs_file_globs" ]; then + symlink_dirs=1 + fi + if [ $copy_always -eq 1 ]; then echo 'X' + elif [ $symlink_dirs -eq 1 ]; then + echo '$' else echo '@' fi @@ -109,7 +117,7 @@ show_file() { output=$dest_file:$abs_src_file if [ $SHOW_SIGILS -eq 1 ]; then - sigil=`sigil_for $src_file` + sigil=`sigil_for $src_file "$symlink_dirs_file_globs"` output="$output:$sigil" fi diff --git a/man/lsrc.1 b/man/lsrc.1 index 984a378..65ba05e 100644 --- a/man/lsrc.1 +++ b/man/lsrc.1 @@ -33,13 +33,18 @@ list dotfiles from the DIR. This can be specified multiple times. show symbols next to each file indicating status information. Supported symbols are .Li @ -which indicates that the file is a symlink, and +which indicates that the file is a symlink, +.Li $ +which indicates it's a symlinked directory, and .Li X -to indicate that the file is a copy. More details on copied files can be -found in -.Xr rcrc 5 , -under the documentation about -.Va COPY_ALWAYS . +to indicate that the file is a copy. More details on copied files and +symlinked directories can be found in +.Xr rcrc 5 +under the documentation on +.Va COPY_ALWAYS +and +.Va SYMLINK_DIRS , +respectively. . .It Fl I Ar excl_pat include the files that match the given pattern. This is applied after -- cgit v1.2.3