Skip to content

Commit

Permalink
Merge pull request #124 from cniethammer/fix-missing-version-options
Browse files Browse the repository at this point in the history
Add missing --version option to the python and bash based ws commands
  • Loading branch information
holgerBerger authored Dec 15, 2024
2 parents 99f3daf + abc4411 commit 22ebfa5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion bin/ws_find
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
+ list expired/moved workspaces
(c) Holger Berger 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
(c) Christoph Niethammer 2024
workspace++ is based on workspace by Holger Berger, Thomas Beisel and Martin Hecht
Expand Down Expand Up @@ -78,7 +79,7 @@ config = yaml.safe_load(open("/etc/ws.conf"))
usage = "Usage: ws_find [options] [workspacename]"

# option configuration
parser = OptionParser(usage=usage)
parser = OptionParser(usage=usage, version="workspace version 1.5.0")
parser.add_option("-F", "--filesystem", dest="filesystem", help="filesystem to search workspace in")
parser.add_option("-l", "--list", action="store_true", dest="list", default=False, help="list valid filesystem names")
(options, args) = parser.parse_args()
Expand Down
3 changes: 2 additions & 1 deletion bin/ws_list
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
+ list expired/moved workspaces
(c) Holger Berger 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024
(c) Christoph Niethammer 2024
workspace++ is based on workspace by Holger Berger, Thomas Beisel and Martin Hecht
Expand Down Expand Up @@ -131,7 +132,7 @@ if os.geteuid() == 0 or os.getuid() == 0:
admin = True

# option configuration
parser = OptionParser(usage="Usage: %prog [options] [pattern]")
parser = OptionParser(usage="Usage: %prog [options] [pattern]", version="workspace version 1.5.0")
parser.add_option("-F", "--filesystem", dest="filesystem", help="filesystem to list workspaces from")
parser.add_option("-g", action="store_true", dest="groupws", default=False, help="also list group workspaces")
parser.add_option("-l", action="store_true", dest="filesystemlist", default=False, help="list available filesystems")
Expand Down
3 changes: 2 additions & 1 deletion bin/ws_register
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
(c) Holger Berger 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
(c) Bernd Krisckok 2017
(c) Christoph Niethammer 2021-2022
(c) Christoph Niethammer 2021-2022,2024
workspace++ is based on workspace by Holger Berger, Thomas Beisel and Martin Hecht
Expand Down Expand Up @@ -73,6 +73,7 @@ username = pwd.getpwuid(uid).pw_name
config = yaml.safe_load(open("/etc/ws.conf"))

parser = argparse.ArgumentParser(description="Creates/updates symbolic links to workspaces in a directory")
parser.add_argument("--version", action='version', version='workspace version 1.5.0')
parser.add_argument(
"directory", metavar="directory", type=pathlib.Path, help="directory in which links shall be created/updated"
)
Expand Down
13 changes: 11 additions & 2 deletions bin/ws_share
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# A workaround to update permissions is to unshare and re-share the workspace
# with the users.
#
# Copyright(c) 2021 Christoph Niethammer <[email protected]>
# Copyright(c) 2021-2024 Christoph Niethammer <[email protected]>
#

progname=$(basename $0)
Expand All @@ -27,6 +27,10 @@ if [[ $? -ne 4 ]]; then
exit 1
fi

function print_version() {
echo "workspace version 1.5.0"
}

function usage() {
cat <<EOF
$progname allows to share an existing workspace with other users.
Expand All @@ -44,14 +48,15 @@ Users that were granted read access to a workspace (WS_NAME) can be listed with
options:
-F, --filesystem ws filesystem
-h, --help show this help
--version show version information and exit
EOF
}


# parse command line, based on example provided by util-linux
OPTIONS=F:h
LONG_OPTIONS=filesystem:,help
LONG_OPTIONS=filesystem:,help,version
PARSED=$(getopt --options=$OPTIONS --longoptions=$LONG_OPTIONS --name "$0" -- "$@")
if [[ $? -ne 0 ]]; then
echo "Error: Command line error"
Expand All @@ -72,6 +77,10 @@ while true; do
FILESYSTEM="$2"
shift 2
;;
--version)
print_version
exit 0
;;
--)
shift
break
Expand Down

0 comments on commit 22ebfa5

Please sign in to comment.