iankelling.org
/
git
/
cedit
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
97f167f
)
add silent mode
author
Ian Kelling
<iank@fsf.org>
Fri, 13 Jan 2023 22:52:07 +0000
(17:52 -0500)
committer
Ian Kelling
<iank@fsf.org>
Fri, 13 Jan 2023 22:52:07 +0000
(17:52 -0500)
cedit
patch
|
blob
|
history
diff --git
a/cedit
b/cedit
index 62331b48c85808fefb44d1866cfec7218484784c..e6d373cde3907f5fb50663b23617f727525fe6e9 100755
(executable)
--- a/
cedit
+++ b/
cedit
@@
-25,20
+25,23
@@
section. Without SECTION_NAME, it acts on a global unnamed
section. cedit is short for config edit.
-q Quiet
section. cedit is short for config edit.
-q Quiet
+-s Silent. Quiet and exit 0 on modified file.
-v Verbose
-b Keep backup file
-h|--help Help"
-v Verbose
-b Keep backup file
-h|--help Help"
- local s diff name init
- local file_dir="$(dirname "$file")"
- local exists=true
- local verbose=false
- local backup=false
- local quiet=false
+ local s diff name init file_dir exists verbose backup quiet silent
+ file_dir="$(dirname "$file")"
+ exists=true
+ verbose=false
+ backup=false
+ quiet=false
+ silent=false
case $1 in
-b) backup=true; shift ;;
-v) verbose=true; shift ;;
-q) quiet=true; shift ;;
case $1 in
-b) backup=true; shift ;;
-v) verbose=true; shift ;;
-q) quiet=true; shift ;;
+ -s) quiet=true; silent=true; shift ;;
-h|--help) echo "$help"; return ;;
esac
-h|--help) echo "$help"; return ;;
esac
@@
-136,6
+139,13
@@
section. cedit is short for config edit.
if ! $backup && $exists; then
rm -r "$temp"
fi
if ! $backup && $exists; then
rm -r "$temp"
fi
- return $ret
+ if $silent; then
+ case $ret in
+ 0|1) return 0 ;;
+ *) return $ret ;;
+ esac
+ else
+ return $ret
+ fi
}
cedit "$@"
}
cedit "$@"