From bc0f839e6674afc8d0d5ffdc27fbe2733161d0b6 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Tue, 16 Apr 2024 01:29:07 -0400 Subject: [PATCH 1/3] add missing license info --- README | 10 ++++++++++ cedit | 9 ++++++++- test/test | 21 +++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/README b/README index 279bfe3..88bd451 100644 --- a/README +++ b/README @@ -1,3 +1,13 @@ +The following is the GNU All-permissive License as recommended in + + +Copyright (C) 2024 Ian Kelling + +Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without any warranty. + The main documentation is availiable via --help and near the top of the bash script file next to this file. diff --git a/cedit b/cedit index 09d7b82..1cfa580 100755 --- a/cedit +++ b/cedit @@ -1,5 +1,12 @@ #!/bin/bash -# Copyright (C) 2016 Ian Kelling +# I, Ian Kelling, follow the GNU license recommendations at +# https://www.gnu.org/licenses/license-recommendations.en.html. They +# recommend that small programs, < 300 lines, be licensed under the +# Apache License 2.0. This file contains or is part of one or more small +# programs. If a small program grows beyond 300 lines, I plan to switch +# its license to GPL. + +# Copyright 2024 Ian Kelling # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/test/test b/test/test index 76eaea4..63c2f65 100755 --- a/test/test +++ b/test/test @@ -1,4 +1,25 @@ #!/bin/bash +# I, Ian Kelling, follow the GNU license recommendations at +# https://www.gnu.org/licenses/license-recommendations.en.html. They +# recommend that small programs, < 300 lines, be licensed under the +# Apache License 2.0. This file contains or is part of one or more small +# programs. If a small program grows beyond 300 lines, I plan to switch +# its license to GPL. + +# Copyright 2024 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + cd $(mktemp -d) -- 2.30.2 From 97e5ceaf2d7d3fec58fcd6b0004f221b19783620 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Wed, 24 Apr 2024 15:34:05 -0400 Subject: [PATCH 2/3] minor docs update --- README | 16 +++++++++------- cedit | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README b/README index 88bd451..0287269 100644 --- a/README +++ b/README @@ -1,12 +1,14 @@ -The following is the GNU All-permissive License as recommended in - +# The following is the GNU All-permissive License as recommended in +# -Copyright (C) 2024 Ian Kelling +# Copyright (C) 2024 Ian Kelling -Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without any warranty. +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + +Create/modify a comment-delimited section in a config file The main documentation is availiable via --help and near the top of the bash script file next to this file. diff --git a/cedit b/cedit index 1cfa580..e47afa5 100755 --- a/cedit +++ b/cedit @@ -22,7 +22,7 @@ cedit() { local help="Usage: [-h|--help ] [-v] [SECTION_NAME] FILE -Create/modify a section in a config file +Create/modify a comment-delimited section in a config file Returns 1 if the file is modified by this command, 2 or higher for other problems. -- 2.30.2 From 26a1849cd31a766d6fbe04ed223b88237543908a Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Mon, 20 May 2024 18:07:58 -0400 Subject: [PATCH 3/3] add option to not alter exit status on modification --- cedit | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cedit b/cedit index e47afa5..9e0b831 100755 --- 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. --q Quiet +-b Keep backup file +-e Exit 0 on modified file. -s Silent. Quiet and exit 0 on modified file. +-q Quiet -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")" @@ -43,12 +44,14 @@ section. cedit is short for config edit. backup=false quiet=false silent=false + exit_status=true 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 ;; - -s) quiet=true; silent=true; shift ;; + -v) verbose=true; shift ;; -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 $silent; then + if ! $exit_status; then case $ret in 0|1) return 0 ;; *) return $ret ;; -- 2.30.2