[ 
https://issues.apache.org/jira/browse/NUTCH-648?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066686#comment-13066686
 ] 

Lewis John McGibbney commented on NUTCH-648:
--------------------------------------------

Same Markus...

I think given the open issues for both 1.X and 2.0 as well as the additional 
complexity you highlight for 2.0 we should close this issue and mark as won't 
fix. Should it be deemed necessary (or indeed wished for) then I'm sure we 
could come back to it, utilise the code posted above and patch it up!  

> debian style autocomplete
> -------------------------
>
>                 Key: NUTCH-648
>                 URL: https://issues.apache.org/jira/browse/NUTCH-648
>             Project: Nutch
>          Issue Type: Improvement
>         Environment: debian, and other linux
>            Reporter: Jim
>            Priority: Minor
>
>         Here is a suggested improvement:  At the end of this file is a debian 
> style bash autocomplete script, just place into /etc/bash_complete.d/ with 
> filename nutch, and you can tab complete at the command prompt, ie
> bash> nutch [tab][tab]
>    crawl readdb convdb mergedb readlinkdb inject generate freegen fetch 
> fetch2 parse
>    readseg mergesegs updatedb invertlinks mergelinkdb index merge dedup 
> plugin server
> bash> nutch c[tab][tab]
>    crawl convdb
> etc.
>    This also includes optional parameters, and filename completion where it 
> can be used.  I really like having this when typing in long nutch commands, 
> and think it would be a great addition to the project.
>    The file is heavily taken from the corresponding svn file that does the 
> same thing.
> File begins here:
> shopt -s extglob
> _nutch()
> {
>        local cur cmds cmdOpts optsParam opt
>        local i
>        COMPREPLY=()
>        cur=${COMP_WORDS[COMP_CWORD]}
>        # Possible expansions
>        cmds='crawl readdb convdb mergedb readlinkdb inject generate freegen 
> fetch fetch2 parse readseg mergesegs updatedb invertlinks \
> mergelinkdb index merge dedup plugin server'
>        if [[ $COMP_CWORD -eq 1 ]] ; then
>                COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
>                return 0
>        fi
>        # options that require a parameter
>        # This needs to be filled in better
>        optsParam="-topN|-depth"
>        # if not typing an option, or if the previous option required a
>        # parameter, then fallback on ordinary filename expansion
>        if [[ "$cur" != -* ]] || \
>           [[ ${COMP_WORDS[COMP_CWORD-1]} == @($optsParam) ]] ; then
>                return 0
>        fi
>        # possible options for the command
>        cmdOpts=
>        case ${COMP_WORDS[1]} in
>        crawl)
>                cmdOpts="-dir -threads -depth -topN"
>                ;;
>        readdb)
>                cmdOpts="-stats -dump -topN -url"
>                ;;
>        convdb)
>                cmdOpts="-withMetadata"
>                ;;
>        mergedb)
>                cmdOpts="-normalize -filter"
>                ;;
>        readlinkdb)
>                cmdOpts="-dump -url"
>                ;;
>        inject)
>                cmdOpts=""
>                ;;
>        generate)
>                cmdOpts="-force -topN -numFetchers -adddays -noFilter"
>                ;;
>        freegen)
>                cmdOpts="-filter -normalize"
>                ;;
>        fetch)
>                cmdOpts="-threads -noParsing"
>                ;;
>        fetch2)
>                cmdOpts="-threads -noParsing"
>                ;;
>        parse)
>                cmdOpts=""
>                ;;
>        readseg)
>                cmdOpts="-dump -list -get -nocontent -nofetch -nogenerate 
> -noparse -noparsedata -noparsetext -dir"
>                ;;
>        mergesegs)
>                cmdOpts="-dir -filter -slice"
>                ;;
>        updatedb)
>                cmdOpts="-dir -force -normalize -filter -noAdditions"
>                ;;
>        invertlinks)
>                cmdOpts="-dir -force -noNormalize -noFilter"
>                ;;
>        mergelinkdb)
>                cmdOpts="-normalize -filter"
>                ;;
>        index)
>                cmdOpts=""
>                ;;
>        merge)
>                cmdOpts="-workingdir"
>                ;;
>        dedup)
>                cmdOpts=""
>                ;;
>        plugin)
>                cmdOpts=""
>                ;;
>        server)
>                cmdOpts=""
>                ;;
>        *)
>                ;;
>        esac
>        # take out options already given
>        for (( i=2; i<=$COMP_CWORD-1; ++i )) ; do
>                opt=${COMP_WORDS[$i]}
>                cmdOpts=" $cmdOpts "
>                cmdOpts=${cmdOpts/ ${opt} / }
>                # skip next option if this one requires a parameter
>                if [[ $opt == @($optsParam) ]] ; then
>                        ((++i))
>                fi
>        done
>        COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
>        return 0
> }
> complete -F _nutch -o default nutch

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to