iankelling.org
/
git
/
cedit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
small refactor for simplification
[cedit]
/
cedit
diff --git
a/cedit
b/cedit
index 68efcae69398a0cb73e60134eaa9972c2579db0d..0a6b4c938a74e9d79fa212d9bc21e852b1f46c0a 100755
(executable)
--- a/
cedit
+++ b/
cedit
@@
-13,17
+13,26
@@
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
-cedit() { # [-v] [section_name] FILE
+cedit() {
+ local help="Usage: [-h|--help ] [-v] [SECTION_NAME] FILE
+Create/modify a section in a config file
+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"
local s diff name init
local file_dir="$(dirname "$file")"
local exists=true
local verbose=false
local s diff name init
local file_dir="$(dirname "$file")"
local exists=true
local verbose=false
- if [[ $1 == -v ]]; then
- verbose=true
- shift
- fi
+ case $1 in
+ -v) verbose=true; shift ;;
+ -h|--help) echo "$help"; return ;;
+ esac
+
if (( $# == 2 )); then
name=": $1"
shift
if (( $# == 2 )); then
name=": $1"
shift