Skip to content

Commit

Permalink
Add --check-none flag to skip checking of PKGBUILD and .install files
Browse files Browse the repository at this point in the history
  • Loading branch information
revan committed Jan 23, 2014
1 parent 501c68c commit e2090fc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Usage: meat OPERATION [OPTIONS] [TARGET [...]]
--check-all When installing, prompts you to check every regular
file in the package directory instead of just the
PKGBUILD and .install files
--check-none When installing, does not prompt you to check files

Output options:
-c, --color[=WHEN]
Expand Down
44 changes: 26 additions & 18 deletions meat
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ optarg= # used for parsing --foo=bar options
repo_ignore=() # array, repos to ignore
check_git=0 # boolean, if 1 --git-check has been specified
check_all=0 # boolean, if 1 --check-all has been specified
check_none=0 # boolean, if 1 --check-none has been specified
force=0 # boolean, if 1 --force has been specified
nossl=0 # boolean, if 1 --nossl has been specified
threads=10 # integer, number of threads for cower to create
Expand Down Expand Up @@ -203,27 +204,29 @@ aur_install() {
### allow user to check PKGBUILD, .install, and other files
# usage: checkfiles PACKAGE
checkfiles() {
local install file pkg=$1
if ((!check_none)); then
local install file pkg=$1

## allow user to edit PKGBUILD and $install
if confirm "Edit PKGBUILD for \`$pkg'?";then
${EDITOR:-vi} PKGBUILD
fi
## allow user to edit PKGBUILD and $install
if confirm "Edit PKGBUILD for \`$pkg'?";then
${EDITOR:-vi} PKGBUILD
fi

# source PKGBUILD for $install, prompt if exists
source PKGBUILD
if [[ $install ]] && confirm "Edit \`$install'?";then
${EDITOR:-vi} "$install"
fi
# source PKGBUILD for $install, prompt if exists
source PKGBUILD
if [[ $install ]] && confirm "Edit \`$install'?";then
${EDITOR:-vi} "$install"
fi

# allow for checking every other regular file
if ((check_all)); then
for file in ./**/!(PKGBUILD|"$install"); do
if [[ -f $file && -w $file && $(file "$file") = *text ]] &&
confirm "Edit \`$file'?";then
${EDITOR:-vi} "$file"
fi
done
# allow for checking every other regular file
if ((check_all)); then
for file in ./**/!(PKGBUILD|"$install"); do
if [[ -f $file && -w $file && $(file "$file") = *text ]] &&
confirm "Edit \`$file'?";then
${EDITOR:-vi} "$file"
fi
done
fi
fi
}

Expand Down Expand Up @@ -650,6 +653,7 @@ Usage: meat OPERATION [OPTIONS] [TARGET [...]]
--check-all When installing, prompts you to check every regular
file in the package directory instead of just the
PKGBUILD and .install files
--check-none When installing, does not prompt you to check files
Output options:
-c, --color[=WHEN]
Expand Down Expand Up @@ -751,6 +755,9 @@ if [[ -r $config_file ]]; then
if [[ $check_all != [01] ]]; then
die "invalid value for \`check_all' in the config file: \`$check_all'"
fi
if [[ $check_none != [01] ]]; then
die "invalid value for \`check_none' in the config file: \`$check_none'"
fi
if [[ $timeout = *[![:digit:]]* ]]; then
die "invalid value for \`timeout' in the config file: \`$timeout'"
fi
Expand Down Expand Up @@ -967,6 +974,7 @@ while [[ $1 = -?* ]]; do
;;
-g|--git-check) check_git=1;;
--check-all) check_all=1;;
--check-none) check_none=1;;

# end of options
--endopts) shift; break;;
Expand Down

0 comments on commit e2090fc

Please sign in to comment.