[gvfs] programs: Handle --help by gvfs tools wrapper
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] programs: Handle --help by gvfs tools wrapper
- Date: Mon, 12 Dec 2016 13:46:22 +0000 (UTC)
commit aa61b05888f2e588acf8a1febb5dd20d8657d753
Author: Ondrej Holy <oholy redhat com>
Date: Mon Dec 12 12:38:16 2016 +0100
programs: Handle --help by gvfs tools wrapper
The gio cmd tool doesn't handle --help/-h for each command.
The expected commandline is the following: "gio help [command]".
Detect this case and call the help properly from wrapper.
This also fixes various xdg-utils scripts.
https://bugzilla.gnome.org/show_bug.cgi?id=775938
programs/Makefile.am | 34 +++++++++++++++++-----------------
programs/deprecated.in | 14 +++++++++++---
2 files changed, 28 insertions(+), 20 deletions(-)
---
diff --git a/programs/Makefile.am b/programs/Makefile.am
index 254a7d4..d7e22e2 100644
--- a/programs/Makefile.am
+++ b/programs/Makefile.am
@@ -22,55 +22,55 @@ bin_SCRIPTS = \
$(NULL)
gvfs-mount: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio mount|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|mount|" $< > $@
gvfs-cat: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio cat|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|cat|" $< > $@
gvfs-open: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio open|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|open|" $< > $@
gvfs-save: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio save|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|save|" $< > $@
gvfs-ls: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio list|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|list|" $< > $@
gvfs-tree: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio tree|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|tree|" $< > $@
gvfs-info: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio info|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|info|" $< > $@
gvfs-set-attribute: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio set|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|set|" $< > $@
gvfs-trash: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio trash|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|trash|" $< > $@
gvfs-rename: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio rename|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|rename|" $< > $@
gvfs-rm: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio remove|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|remove|" $< > $@
gvfs-copy: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio copy|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|copy|" $< > $@
gvfs-move: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio move|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|move|" $< > $@
gvfs-monitor-file: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio monitor|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|monitor|" $< > $@
gvfs-monitor-dir: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio monitor|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|monitor|" $< > $@
gvfs-mkdir: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio mkdir|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|mkdir|" $< > $@
gvfs-mime: deprecated.in Makefile
- $(AM_V_GEN) $(SED) -e "s|\@replacement\@|gio mime|" $< > $@
+ $(AM_V_GEN) $(SED) -e "s|\@command\@|mime|" $< > $@
EXTRA_DIST = \
deprecated.in \
diff --git a/programs/deprecated.in b/programs/deprecated.in
index 70d0b83..0072255 100644
--- a/programs/deprecated.in
+++ b/programs/deprecated.in
@@ -1,6 +1,14 @@
#!/bin/sh
-replacement="@replacement@"
+
+replacement="gio @command@"
+help="gio help @command@"
+
&2 echo "This tool has been deprecated, use '$replacement' instead."
->&2 echo "See 'gio help' for more info."
+>&2 echo "See '$help' for more info."
&2 echo
-exec $replacement "$@"
+
+if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
+ exec $help "$@:2"
+else
+ exec $replacement "$@"
+fi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]