diff options
author | Ondrej Holy <oholy@redhat.com> | 2016-12-12 12:38:16 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2016-12-12 12:38:16 +0100 |
commit | aa61b05888f2e588acf8a1febb5dd20d8657d753 (patch) | |
tree | fa9125426b31a7a6ee1a0b633d0961ea18f0f8f4 | |
parent | 41a4f6414f0ad663ad000745fbdbd8c64ef7eecd (diff) | |
download | gvfs-aa61b05888f2e588acf8a1febb5dd20d8657d753.tar.gz |
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
-rw-r--r-- | programs/Makefile.am | 34 | ||||
-rw-r--r-- | programs/deprecated.in | 14 |
2 files changed, 28 insertions, 20 deletions
diff --git a/programs/Makefile.am b/programs/Makefile.am index 254a7d4f..d7e22e2a 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 70d0b832..00722557 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 |