Permalink
Browse files

add output option to pkgenv

Using `pkgenv -o` or `pkgenv --output` will now cat the file instead of editing it.
  • Loading branch information...
1 parent 402f712 commit 1e9bca22a8fcf5107117134d7916e8ae071e20c9 @extraordinaire extraordinaire committed Feb 27, 2014
Showing with 9 additions and 0 deletions.
  1. +9 −0 scripts/pkgenv
View
9 scripts/pkgenv
@@ -6,6 +6,7 @@ function show_usage() {
echo "Usage: gvm pkgenv [packageset-name]"
echo
echo " -h, --help Display this message."
+ echo " -o, --output Write content to stdout"
echo
echo "The [packageset-name] is optional."
echo
@@ -17,6 +18,9 @@ for i in $*; do
show_usage
exit 0
;;
+ -o|--output*)
+ output=true
+ ;;
*)
gvm_env="$i"
;;
@@ -33,4 +37,9 @@ fi
env_file=$GVM_ROOT/environments/$gvm_go_name$gvm_env
+if [ $output ]; then
+ cat $env_file
+ exit 0
+fi
+
$(printenv EDITOR || echo 'vi') $env_file

0 comments on commit 1e9bca2

Please sign in to comment.