Compare commits
6
Commits
a22290a3c0
...
9a4a5e8d74
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a4a5e8d74 | ||
|
|
f4a3779b04 | ||
|
|
8f69bed7d9 | ||
|
|
14a0d810ee | ||
|
|
2e06b13a69 | ||
|
|
80cf6138bc |
+124
-16
@@ -1,25 +1,133 @@
|
||||
#compdef dotfiles.sh
|
||||
|
||||
_dotfiles.sh() {
|
||||
integer ret=1
|
||||
local -a args
|
||||
typeset -A opt_args
|
||||
|
||||
args+=(
|
||||
'*'{-a,--add=}'[add file to the dotfiles directory]:file:_files'
|
||||
'(-f --files)'{-f,--files}'[display all files added to the dotfiles directory]'
|
||||
# Argument definition
|
||||
# ------------------------------------------
|
||||
|
||||
_dotfiles_operations=(
|
||||
{-F-,--file}'[display all files added to the dotfiles directory]'
|
||||
{-P-,--package}'[instal, print or store packages]'
|
||||
'(-)'{-h,--help}'[display usage message and exit]'
|
||||
'(-p --packages)'{-p,--packages=}'[instal, list or store packages]:package functions:((
|
||||
install\:"install all core packages of the stored list"
|
||||
install-aur\:"install all AUR packages of the stored list"
|
||||
list\:"display all packages installed on the system (default)"
|
||||
store\:"stores a list of all installed packages"
|
||||
))'
|
||||
'(-l --pull)'{-l,--pull}'[pull each added file from system to dotfiles directory]'
|
||||
'(-s --push)'{-s,--push}'[push each added file to its location on the system]'
|
||||
)
|
||||
|
||||
_arguments -s -S $args[@] && ret=0
|
||||
return ret
|
||||
_dotfiles_file_options=(
|
||||
'(-F --file)'{-F,--file}
|
||||
'(-a --add)'{-a,--add}'[add selected file paths to the dotfiles directory]'
|
||||
'(-l --pull)'{-l,--pull}'[pull file(s) from the system to the dotfiles directory]'
|
||||
'(-s --push)'{-s,--push}'[push file(s) from the dotfiles directory to the system]'
|
||||
)
|
||||
|
||||
_dotfiles_package_options=(
|
||||
'(-P --package)'{-P,--package}
|
||||
'(-a --aur-install)'{-a,--aur-install}'[install all AUR packages of the stored list]'
|
||||
'(-i --install)'{-i,--install}'[install all official packages of the stored list]'
|
||||
'(-s --store)'{-s,--store}'[stores a list of all installed packages on the system]'
|
||||
)
|
||||
|
||||
_dotfiles_dotfile_directory_target=(
|
||||
'*:file:_files'
|
||||
)
|
||||
|
||||
_dotfiles_home_directory_target=(
|
||||
'*:file:_files -W ~/'
|
||||
)
|
||||
|
||||
# Argument handling
|
||||
# ------------------------------------------
|
||||
|
||||
function _dotfiles_file_argument_handling()
|
||||
{
|
||||
case "$tmp" in
|
||||
-*)
|
||||
_arguments -s : "$_dotfiles_file_options[@]" && result=0
|
||||
;;
|
||||
*)
|
||||
# Enable matching of dotfiles without explicitly specifying the dot
|
||||
setopt globdots
|
||||
|
||||
case "$args" in
|
||||
*a*)
|
||||
_arguments -s : "$_dotfiles_home_directory_target[@]" && result=0
|
||||
;;
|
||||
*)
|
||||
_arguments -s : "$_dotfiles_dotfile_directory_target[@]" && result=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function _dotfiles_package_argument_handling()
|
||||
{
|
||||
case "$tmp" in
|
||||
-*)
|
||||
_arguments -s : "$_dotfiles_package_options[@]" && result=0
|
||||
;;
|
||||
*)
|
||||
case "$args" in
|
||||
P)
|
||||
_arguments -s : '*:package:_dotfiles_completions_tracked_packages' && result=0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
if ! zmodload -s zsh/mapfile; then
|
||||
function _dotfiles_completions_tracked_packages() {}
|
||||
else
|
||||
function _dotfiles_completions_tracked_packages()
|
||||
{
|
||||
local -a packages
|
||||
packages=( "${(f@)${mapfile[packages]%$'\n'}}" )
|
||||
readonly packages
|
||||
compadd "$@" -a packages
|
||||
}
|
||||
fi
|
||||
|
||||
# Completion control flow
|
||||
# ------------------------------------------
|
||||
|
||||
_dotfiles.sh()
|
||||
{
|
||||
local result=1
|
||||
local -a args
|
||||
local tmp
|
||||
|
||||
# Get all short flags
|
||||
args=( ${${${(M)words:#-*}#-}:#-*} )
|
||||
# Get the current flag
|
||||
tmp="$words[-1]"
|
||||
|
||||
case "$args" in
|
||||
h*)
|
||||
_message -e arguments "no more arguments"
|
||||
;;
|
||||
F*)
|
||||
_dotfiles_file_argument_handling
|
||||
;;
|
||||
P*)
|
||||
_dotfiles_package_argument_handling
|
||||
;;
|
||||
*)
|
||||
case ${(M)words:#--*} in
|
||||
*--file*)
|
||||
_dotfiles_file_argument_handling
|
||||
;;
|
||||
*--package*)
|
||||
_dotfiles_package_argument_handling
|
||||
;;
|
||||
*)
|
||||
_arguments -s : "$_dotfiles_operations[@]" && result=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
_dotfiles.sh
|
||||
|
||||
+235
-106
@@ -1,9 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Manages dotfiles and packages
|
||||
# Tracks dotfiles and packages
|
||||
# Depends: GNU getopt, (pacman, pacman-contrib) / (dpkg, apt)
|
||||
|
||||
# User-config---------------------------
|
||||
# User-config
|
||||
# --------------------------------------
|
||||
|
||||
# File which holds all installed packages
|
||||
packageFile="packages"
|
||||
@@ -19,79 +20,143 @@ aurHelper="trizen"
|
||||
|
||||
# --------------------------------------
|
||||
|
||||
b="$(tput bold)"
|
||||
red="$(tput setf 4)"
|
||||
n="$(tput sgr0)"
|
||||
|
||||
if [ "$(dirname "$0")" != "." ]; then
|
||||
echo "Please run this script from the directory it resides." >&2
|
||||
echo "${b}${red}Error:${n} please run this script from the directory it resides." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
help()
|
||||
{
|
||||
B=$(tput bold)
|
||||
U=$(tput smul)
|
||||
N=$(tput sgr0)
|
||||
(cat << EOF
|
||||
.TH DOTFILES.SH 1 "2021-08-22" "dotfiles.sh 0.9" "dotfiles.sh Manual"
|
||||
|
||||
cat << EOF
|
||||
${B}NAME${N}
|
||||
dotfiles - manages dotfiles and packages
|
||||
.SH NAME
|
||||
dotfiles.sh \- config file and package tracking utility
|
||||
|
||||
${B}SYNOPSIS${N}
|
||||
${B}./dotfiles.sh${N} ${U}OPTION${N} [${U}ARG${N}]
|
||||
.SH SYNOPSIS
|
||||
.B ./dotfiles.sh
|
||||
.I OPERATION
|
||||
.RI [ OPTION ...]\&
|
||||
.RI [ TARGET ...]
|
||||
|
||||
${B}OPTIONS${N}
|
||||
${B}-a${N} ${U}FILE${N}, ${B}--add${N}=${U}FILE${N}
|
||||
Add file to the dotfiles directory.
|
||||
.SH DESCRIPTION
|
||||
dotfiles.sh is a config file and package tracking utility that tracks installed packages on a Linux system.
|
||||
It features listing and tracking of config files and packages, and the ability to install the tracked packages.
|
||||
|
||||
${B}-f, --files${N}
|
||||
Display all files added to the dotfiles directory.
|
||||
Currently, package tracking is only supported on APT and Pacman based distributions.
|
||||
|
||||
${B}-h, --help${N}
|
||||
Invoking dotfile.sh involves specifying an operation with any potential options and targets to operate on.
|
||||
A \fItarget\fR is usually a file name, directory or a package name.
|
||||
Targets can be provided as command line arguments.
|
||||
Additionally, if a single hyphen (-) is passed as an argument, targets will be read from stdin.
|
||||
|
||||
.SH OPERATIONS
|
||||
.TP
|
||||
.BR \-F ", " \-\-file
|
||||
Operate on config files.
|
||||
This operation allows you to sync config files between the system and the dotfiles directory.
|
||||
In the first case, if no file names are provided in the command line, all files will be selected.
|
||||
See File Options below.
|
||||
|
||||
.TP
|
||||
.BR \-P ", " \-\-package
|
||||
Operate on packages.
|
||||
This operation allows you to track installed packages and reinstall them.
|
||||
In the first case, if no package names are provided in the command line, all packages will be selected.
|
||||
See Package Options below.
|
||||
|
||||
.TP
|
||||
.BR \-h ", " \-\-help
|
||||
Display usage message and exit.
|
||||
|
||||
${B}-p${N} [${U}FUNCTION${N}], ${B}--packages${N}=[${U}FUNCTION${N}]
|
||||
Apply ${U}FUNCTION${N} to the package manager packages.
|
||||
.SH FILE OPTIONS (APPLY TO -F)
|
||||
.TP
|
||||
.BR \-a ", " \-\-add
|
||||
Add selected file \fIpaths\fR to the dotfiles directory.
|
||||
|
||||
${U}install${N} Install all core packages of the stored list.
|
||||
.TP
|
||||
.BR \-l ", " \-\-pull
|
||||
Pull every (selected) \fIfile\fR from the system to the dotfiles directory.
|
||||
|
||||
${U}install-aur${N} Install all AUR packages of the stored list.
|
||||
.TP
|
||||
.BR \-s ", " \-\-push
|
||||
Push every (selected) \fIfile\fR from the dotfiles directory to the system.
|
||||
|
||||
${U}list${N} Display all packages installed on the system.
|
||||
.SH PACKAGE OPTIONS (APPLY TO -P)
|
||||
.TP
|
||||
.BR \-a ", " \-\-aur-install
|
||||
Install all AUR packages of the stored list.
|
||||
|
||||
${U}store${N} Stores a list of all installed packages on the system.
|
||||
.TP
|
||||
.BR \-i ", " \-\-install
|
||||
Install all official packages of the stored list.
|
||||
|
||||
The default value is ${U}list${N}.
|
||||
.TP
|
||||
.BR \-s ", " \-\-store
|
||||
Stores a list of all installed packages on the system.
|
||||
|
||||
${B}-l, --pull${N}
|
||||
Pull each added file from the system to the dotfiles directory.
|
||||
.SH EXAMPLES
|
||||
Usage examples:
|
||||
|
||||
${B}-s, --push${N}
|
||||
Push each added file to its location on the system.
|
||||
$ \fB./dotfiles.sh\fR -Fa ~/.zshrc /etc/zsh/zshenv
|
||||
.br
|
||||
\h'4'Add config files to the dotfiles directory
|
||||
|
||||
$ \fB./dotfiles.sh\fR -Pia
|
||||
.br
|
||||
\h'4'Install all tracked official and AUR packages
|
||||
|
||||
.SH AUTHOR
|
||||
Riyyi
|
||||
EOF
|
||||
) | man -l -
|
||||
}
|
||||
|
||||
# Exit if no option is provided
|
||||
[ "$#" -eq 0 ] && help >&2 && exit 1
|
||||
[ "$#" -eq 0 ] && help && exit 1
|
||||
|
||||
# Files
|
||||
# --------------------------------------
|
||||
|
||||
setFiles()
|
||||
getFileList()
|
||||
{
|
||||
files="$(find . -type f -o -type l \
|
||||
fileList="$(find . -type f -o -type l \
|
||||
| awk -v e="^./($excludeFiles)" '$0 !~ e { print $0 }')"
|
||||
}
|
||||
|
||||
listFiles()
|
||||
separateFileList()
|
||||
{
|
||||
# If unset
|
||||
[ -z "${files+x}" ] && setFiles
|
||||
[ -z "$fileList" ] && getFileList
|
||||
|
||||
# Remove leading ./ from filepaths
|
||||
echo "$files" | sed 's/^\.\///'
|
||||
match="^./($systemDir)/"
|
||||
|
||||
# Filter system directories and remove leading ./ from filepaths
|
||||
homeFileList="$(echo "$fileList" \
|
||||
| awk -v m="$match" '$0 !~ m { print substr($0, 3) }')"
|
||||
|
||||
# Filter non-system directories and remove leading ./ from filepaths
|
||||
systemFileList="$(echo "$fileList" \
|
||||
| awk -v m="$match" '$0 ~ m { print substr($0, 3) }')"
|
||||
}
|
||||
|
||||
add()
|
||||
filterFileList()
|
||||
{
|
||||
[ -z "$1" ] && return 1
|
||||
if [ -z "$homeFileList" ] || [ -z "$systemFileList" ]; then
|
||||
separateFileList
|
||||
fi
|
||||
|
||||
# Filter on provided file name
|
||||
homeFileListLoop="$(echo "$homeFileList" | grep "^$1")"
|
||||
systemFileListLoop="$(echo "$systemFileList" | grep "^$1")"
|
||||
}
|
||||
|
||||
fileAdd()
|
||||
{
|
||||
[ -z "$1" ] && exit 1
|
||||
|
||||
file="$(readlink -f "$(dirname "$1")")/$(basename "$1")"
|
||||
fileCutHome="$(echo "$file" \
|
||||
@@ -108,52 +173,51 @@ add()
|
||||
fi
|
||||
}
|
||||
|
||||
pullPush()
|
||||
filePull()
|
||||
{
|
||||
# If unset or empty string
|
||||
[ -z "$1" ] && return 1
|
||||
filterFileList "$1"
|
||||
|
||||
# If unset
|
||||
[ -z "${files+x}" ] && setFiles
|
||||
|
||||
match="^./($systemDir)/"
|
||||
|
||||
# Filter system directories and remove leading ./ from filepaths
|
||||
homeFiles="$(echo "$files" \
|
||||
| awk -v m="$match" '$0 !~ m { print substr($0, 3) }')"
|
||||
|
||||
for f in $homeFiles; do
|
||||
if [ "$1" = "pull" ]; then
|
||||
# cp /home/<user>/<file> /[<some dir>/]dotfiles/<file>
|
||||
cp -a "$HOME/$f" "$(pwd)/$f"
|
||||
elif [ "$1" = "push" ]; then
|
||||
mkdir -p "$(dirname "$HOME/$f")"
|
||||
cp -a "$(pwd)/$f" "$HOME/$f"
|
||||
fi
|
||||
for file in $homeFileListLoop; do
|
||||
# /home/<user>/<file> -> dotfiles/<file>
|
||||
cp -a "$HOME/$file" "$(pwd)/$file"
|
||||
done
|
||||
|
||||
# Filter non-system directories and remove leading ./ from filepaths
|
||||
systemFiles="$(echo "$files" \
|
||||
| awk -v m="$match" '$0 ~ m { print substr($0, 3) }')"
|
||||
|
||||
for f in $systemFiles; do
|
||||
if [ "$1" = "pull" ]; then
|
||||
# cp /<file> /[<some dir>/]dotfiles/<file>
|
||||
sudo cp -a "/$f" "$(pwd)/$f"
|
||||
elif [ "$1" = "push" ]; then
|
||||
sudo cp -a "$(pwd)/$f" "/$f"
|
||||
fi
|
||||
for file in $systemFileListLoop; do
|
||||
# /<file> -> dotfiles/<file>
|
||||
sudo cp -a "/$file" "$(pwd)/$file"
|
||||
done
|
||||
}
|
||||
|
||||
pull()
|
||||
filePush()
|
||||
{
|
||||
pullPush "pull"
|
||||
filterFileList "$1"
|
||||
|
||||
for file in $homeFileListLoop; do
|
||||
# dotfiles/<file> -> /home/<user>/<file>
|
||||
mkdir -p "$(dirname "$HOME/$file")"
|
||||
cp -a "$(pwd)/$file" "$HOME/$file"
|
||||
done
|
||||
|
||||
for file in $systemFileListLoop; do
|
||||
# dotfiles/<file> -> /<file>
|
||||
sudo mkdir -p "$(dirname "/$file")"
|
||||
sudo cp -a "$(pwd)/$file" "/$file"
|
||||
done
|
||||
}
|
||||
|
||||
push()
|
||||
files()
|
||||
{
|
||||
pullPush "push"
|
||||
if [ "$1" = "list" ] || [ "$1" = "" ]; then
|
||||
[ -z "$fileList" ] && getFileList
|
||||
# Remove leading ./ from filepaths
|
||||
echo "$fileList" | sed 's/^\.\///' | grep "$2"
|
||||
elif [ "$1" = "add" ]; then
|
||||
fileAdd "$2"
|
||||
elif [ "$1" = "pull" ]; then
|
||||
filePull "$2"
|
||||
elif [ "$1" = "push" ]; then
|
||||
filePush "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
# Packages
|
||||
@@ -175,7 +239,7 @@ osDetect()
|
||||
elif echo "$idLike" | grep -q 'ubuntu'; then
|
||||
os="debian"
|
||||
else
|
||||
echo "Unsupported operating system." >&2
|
||||
echo "${b}${red}Error:${n} unsupported operating system." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@@ -199,13 +263,13 @@ osDependencies()
|
||||
binary="$(echo "$pair" | cut -d ':' -f 1)"
|
||||
if ! command -v "$binary" > /dev/null; then
|
||||
dependency="$(echo "$pair" | cut -d ':' -f 2)"
|
||||
echo "Please install the '$dependency' dependency before running this option." >&2
|
||||
echo "${b}${red}Error:${n} required dependency '$dependency' is missing." >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
packageList()
|
||||
getPackageList()
|
||||
{
|
||||
if [ "$os" = "arch" ]; then
|
||||
filterList="$( (pacman -Qqg base base-devel; pactree -u base | tail -n +2) | sort)"
|
||||
@@ -226,16 +290,15 @@ packageInstall()
|
||||
# Grab everything off enabled official repositories that is in the list
|
||||
repoList="$(pacman -Ssq | grep -xf $packageFile)"
|
||||
|
||||
if [ "$1" = "install" ]; then
|
||||
# Install packages
|
||||
echo "$repoList" | xargs --open-tty sudo pacman -Sy --needed
|
||||
fi
|
||||
if [ "$1" = "install-aur" ]; then
|
||||
if [ "$1" = "aur-install" ]; then
|
||||
# Determine which packages in the list are from the AUR
|
||||
aurList="$(grep -vx "$repoList" < $packageFile)"
|
||||
|
||||
# Install AUR packages
|
||||
echo "$aurList" | xargs --open-tty "$aurHelper" -Sy --needed --noconfirm
|
||||
elif [ "$1" = "install" ]; then
|
||||
# Install packages
|
||||
echo "$repoList" | xargs --open-tty sudo pacman -Sy --needed
|
||||
fi
|
||||
elif [ "$os" = "debian" ]; then
|
||||
# Grab everything off enabled official repositories that is in the list
|
||||
@@ -252,60 +315,73 @@ packages()
|
||||
if [ -z "$os" ]; then
|
||||
osDetect
|
||||
osDependencies
|
||||
packageList
|
||||
fi
|
||||
|
||||
if [ "$1" = "list" ] || [ "$1" = "" ]; then
|
||||
echo "$packageList"
|
||||
[ -z "$packageList" ] && getPackageList
|
||||
echo "$packageList" | grep "$2"
|
||||
elif [ "$1" = "store" ]; then
|
||||
[ -z "$packageList" ] && getPackageList
|
||||
echo "$packageList" > "$packageFile"
|
||||
elif [ "$1" = "aur-install" ]; then
|
||||
packageInstall "aur-install"
|
||||
elif [ "$1" = "install" ]; then
|
||||
packageInstall "install"
|
||||
elif [ "$1" = "install-aur" ]; then
|
||||
packageInstall "install-aur"
|
||||
fi
|
||||
}
|
||||
|
||||
# Option handling
|
||||
# Option parsing
|
||||
# --------------------------------------
|
||||
|
||||
script="$(basename "$0")"
|
||||
options="$(getopt --options "ha:fp::ls" --longoptions "help,add:,files,packages::,pull,push" -n "$script" -- "$@" 2>&1)"
|
||||
parsed="$(getopt --options "hFPails" \
|
||||
--longoptions "help,file,package,add,aur-install,install,pull,push,store" \
|
||||
-n "$script" -- "$@" 2>&1)"
|
||||
result="$?"
|
||||
|
||||
# Exit if invalid option is provided
|
||||
if [ "$result" -ne 0 ]; then
|
||||
echo "$options" | head -n 1 >&2
|
||||
echo "$parsed" | head -n 1 >&2
|
||||
echo "Try './$script --help' for more information." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- "$options"
|
||||
eval set -- "$parsed"
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-a | --add)
|
||||
add "$2"
|
||||
shift 2
|
||||
;;
|
||||
-f | --files)
|
||||
listFiles
|
||||
-F | --file)
|
||||
if [ -n "$mode" ]; then
|
||||
echo "${b}${red}Error:${n} only one operation may be used at a time." >&2
|
||||
exit 1
|
||||
fi
|
||||
mode="file"
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
help
|
||||
exit
|
||||
-P | --package)
|
||||
if [ -n "$mode" ]; then
|
||||
echo "${b}${red}Error:${n} only one operation may be used at a time." >&2
|
||||
exit 1
|
||||
fi
|
||||
mode="package"
|
||||
shift
|
||||
;;
|
||||
-p | --packages)
|
||||
packages "$2"
|
||||
shift 2
|
||||
-a | --add | --aur-install)
|
||||
[ "$mode" = "file" ] && options="${options}add "
|
||||
[ "$mode" = "package" ] && options="${options}aur-install "
|
||||
shift
|
||||
;;
|
||||
-i | --install)
|
||||
options="${options}install "
|
||||
shift
|
||||
;;
|
||||
-l | --pull)
|
||||
pull
|
||||
options="${options}pull "
|
||||
shift
|
||||
;;
|
||||
-s | --push)
|
||||
push
|
||||
-s | --push | --store)
|
||||
[ "$mode" = "file" ] && options="${options}push "
|
||||
[ "$mode" = "package" ] && options="${options}store "
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
@@ -318,5 +394,58 @@ while true; do
|
||||
esac
|
||||
done
|
||||
|
||||
# @Todo:
|
||||
# push function to push just one file
|
||||
# Target parsing
|
||||
# --------------------------------------
|
||||
|
||||
targets="$*"
|
||||
targetsNoHyphen="$(echo "$targets" | sed -E 's/(^-$|\s-|-\s)//g; s/(\s-\s)/ /;')"
|
||||
|
||||
# Read targets from stdin
|
||||
if [ "$targets" != "$targetsNoHyphen" ]; then
|
||||
if [ -t 0 ]; then
|
||||
echo "${b}${red}Error:${n} argument '-' specified without input on stdin." >&2
|
||||
exit 1
|
||||
fi
|
||||
eval set -- "$targetsNoHyphen $(cat /dev/stdin)"
|
||||
fi
|
||||
|
||||
# Execute
|
||||
# --------------------------------------
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
echo "${b}${red}Error:${n} no operation specified (use -h for help)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$mode" = "file" ]; then
|
||||
if [ -z "$options" ]; then
|
||||
files "list" "$@"
|
||||
exit
|
||||
fi
|
||||
|
||||
for option in $options; do
|
||||
if [ -z "$*" ]; then
|
||||
if [ "$option" = "add" ];then
|
||||
echo "${b}${red}Error:${n} no files or directories selected to add." >&2
|
||||
exit 1
|
||||
fi
|
||||
files "$option"
|
||||
continue
|
||||
fi
|
||||
|
||||
for path; do
|
||||
files "$option" "$path"
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$mode" = "package" ]; then
|
||||
if [ -z "$options" ]; then
|
||||
packages "list" "$@"
|
||||
exit
|
||||
fi
|
||||
|
||||
for option in $options; do
|
||||
packages "$option"
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user