Ok, changing the help-pages to be able to iterate over options is
indeed a lot of work, I guess.

I made a simple Bash-script to do 'sort of' what I meant, in a very
limited way, but I find it quite useful already.

Script pasted below and available at
http://home.mircad.nl/md/fossil_apropos_search.html . Tested on Linux
and NetBSD (with an existing /usr/bin/bash).

---8<---8<---8<---

#!/usr/bin/bash



# WHAT IS THIS?
#
#     This script performs a search through Fossil command-options.
#
# CAVEAT
#
#     The method to filter out options from the other text is feeble -
#     only lines from help-pages beginning with whitespace are
#     considered. This works reasonably well. Obviously, this tool is
#     meant as a supplement to 'fossil help' only.
#
# SYNTAX
#
#     fapropos <needle> [<whence>]
#
#         <needle>: the string to search for
#
#         <whence> an optional command-set specifier, e.g. "-t" for
#                  test-commands, or "-w" for WWW-commands. If not
#                  given, defaults to "-a" ("all commands").



F=fossil

needle=$1
shift
[ -n "$needle" ]  ||  { echo "Use a search-string"; exit; }

whence=$*
[ -n "$whence" ]  ||  whence="-a"



cmds=$( $F help $whence | xargs echo )

for c in $cmds; do

    opts=$( $F help $c | grep '^ ' | grep -- "$needle" )

    if [ -n "$opts" ]; then
        echo $c:
        echo "$opts" | sed 's/^ */    /'
        echo
    fi
done

---8<---8<---8<---

Michai

On 21 July 2015 at 11:06, Michai Ramakers <m.ramak...@gmail.com> wrote:
> Hello,
>
> I was searching for a way to close a leaf from the command-line, and
> didn't find it. (The new 'check-in-edit' branch can do this using
> 'amend --close'.)
>
> Is there a way using legacy commands?
>
> Also, I notice there are generally questions on this list of the form
> 'where is command XYZ to do PQR', just like this very post. As the set
> of command-line commands and options grows, it becomes more difficult
> to find how to do something; some functionality exists as a separate
> command, some other exists as option to a command. (I had expected the
> 'branch' command to have a 'close' subcommand, for instance.)
>
> Is it an idea to have an 'apropos(1)'-like subcommand or option to the
> 'help' command? For those that don't know, the 'apropos' command on
> *nix does a keyword search accross all manual pages - or perhaps
> help-pages, in case of fossil.
>
> In my case, I knew I needed/wanted something that CLOSEs something, so
> I would have keyword-searched for 'close'.
>
> I'm happy with the 'amend' command btw. And I guess that as I become
> more familiar with fossil's internals or philosophy, it becomes easier
> to guess the command that provides a wanted behaviour.
>
> Michai
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to