X-Git-Url: https://iankelling.org/git/?p=cedit;a=blobdiff_plain;f=cedit;h=629fe01b1e01db5baabbed83a317206dca5ef2bb;hp=d04f587b62928d5ab9744bdccac5e890eb07b895;hb=3e93da34a19ca898d8c1ab7902e600d2a9a2defa;hpb=9cc02c92c1630a410f64fa4cb747863d01e54947 diff --git a/cedit b/cedit index d04f587..629fe01 100755 --- a/cedit +++ b/cedit @@ -15,10 +15,11 @@ cedit() { local help="Usage: [-h|--help ] [-v] [SECTION_NAME] FILE -Create/edit a #comment delimited section of a file +Create/modify a section in a config file -Reads STDIN for the contents of the section. Without SECTION_NAME, it -acts on a global unnamed section. cedit is short for config edit. +The section is #comment delimited. Reads STDIN for the contents of the +section. Without SECTION_NAME, it acts on a global unnamed +section. cedit is short for config edit. -v Verbose -h|--help Help" @@ -28,13 +29,10 @@ acts on a global unnamed section. cedit is short for config edit. local verbose=false case $1 in + -v) verbose=true; shift ;; -h|--help) echo "$help"; return ;; esac - if [[ $1 == -v ]]; then - verbose=true - shift - fi if (( $# == 2 )); then name=": $1" shift @@ -110,11 +108,10 @@ acts on a global unnamed section. cedit is short for config edit. fi else diff=$(cmp "$temp" "$file") - ret=$? if $verbose; then echo "$diff" fi fi - return $ret + return 0 } cedit "$@"