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:
97e5cea
)
add option to not alter exit status on modification
master
author
Ian Kelling
<iank@fsf.org>
Mon, 20 May 2024 22:07:58 +0000
(18:07 -0400)
committer
Ian Kelling
<iank@fsf.org>
Mon, 20 May 2024 22:07:58 +0000
(18:07 -0400)
cedit
patch
|
blob
|
history
diff --git
a/cedit
b/cedit
index e47afa5f749407087a25259c027c612262bd7265..9e0b831f848d9600c4a61415783bb0881ee9f409 100755
(executable)
--- a/
cedit
+++ b/
cedit
@@
-31,10
+31,11
@@
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.
section. Without SECTION_NAME, it acts on a global unnamed
section. cedit is short for config edit.
--q Quiet
+-b Keep backup file
+-e Exit 0 on modified file.
-s Silent. Quiet and exit 0 on modified file.
-s Silent. Quiet and exit 0 on modified file.
+-q Quiet
-v Verbose
-v Verbose
--b Keep backup file
-h|--help Help"
local s diff name init file_dir exists verbose backup quiet silent
file_dir="$(dirname "$file")"
-h|--help Help"
local s diff name init file_dir exists verbose backup quiet silent
file_dir="$(dirname "$file")"
@@
-43,12
+44,14
@@
section. cedit is short for config edit.
backup=false
quiet=false
silent=false
backup=false
quiet=false
silent=false
+ exit_status=true
case $1 in
-b) backup=true; shift ;;
case $1 in
-b) backup=true; shift ;;
- -v) verbose=true; shift ;;
+ -e) exit_status=false; shift ;;
+ -s) quiet=true; silent=true; exit_status=false; shift ;;
-q) quiet=true; shift ;;
-q) quiet=true; shift ;;
- -
s) quiet=true; silent
=true; shift ;;
+ -
v) verbose
=true; shift ;;
-h|--help) echo "$help"; return ;;
esac
-h|--help) echo "$help"; return ;;
esac
@@
-153,7
+156,7
@@
section. cedit is short for config edit.
if ! $backup && $exists; then
rm -r "$temp"
fi
if ! $backup && $exists; then
rm -r "$temp"
fi
- if
$silent
; then
+ if
! $exit_status
; then
case $ret in
0|1) return 0 ;;
*) return $ret ;;
case $ret in
0|1) return 0 ;;
*) return $ret ;;