All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denys Dmytriyenko <denys@ti.com>
To: Jacob Stiffler <j-stiffler@ti.com>
Cc: meta-arago@arago-project.org
Subject: Re: [RFC][PATCH 1/2] opkg-bash-completion: add simple completions for opkg
Date: Tue, 21 Jan 2020 15:32:53 -0500	[thread overview]
Message-ID: <20200121203252.GE31036@beryl> (raw)
In-Reply-To: <1579625923-14558-1-git-send-email-j-stiffler@ti.com>

On Tue, Jan 21, 2020 at 11:58:42AM -0500, Jacob Stiffler wrote:
> This is a simpe start to bash completions for opkg. Initialy, this can
> complete current supported verbs (static) and complete package names
> (dynamic).

Oh, nice! Thanks for taking a stab at it!


> Signed-off-by: Jacob Stiffler <j-stiffler@ti.com>
> ---
>  .../recipes-devtools/opkg/opkg-bash-completion.bb  | 15 +++++++++++++
>  .../opkg/opkg-bash-completion/opkg-bash-completion | 26 ++++++++++++++++++++++
>  2 files changed, 41 insertions(+)
>  create mode 100644 meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion.bb
>  create mode 100644 meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion/opkg-bash-completion
> 
> diff --git a/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion.bb b/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion.bb
> new file mode 100644
> index 0000000..74e4964
> --- /dev/null
> +++ b/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion.bb
> @@ -0,0 +1,15 @@
> +SUMMARY = "bash-completions for opkg"
> +LICENSE = "MIT"
> +
> +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
> +
> +SRC_URI = "file://opkg-bash-completion"
> +
> +do_install() {
> +    install -d ${D}${datadir}/bash-completion/completions
> +    install -m 0644 ${WORKDIR}/opkg-bash-completion \
> +                    ${D}${datadir}/bash-completion/completions/opkg
> +}
> +
> +FILES_${PN} = "${datadir}/bash-completion/completions/opkg"
> +RDEPENDS_${PN} = "bash-completion"
> diff --git a/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion/opkg-bash-completion b/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion/opkg-bash-completion
> new file mode 100644
> index 0000000..5b0b4e1
> --- /dev/null
> +++ b/meta-arago-extras/recipes-devtools/opkg/opkg-bash-completion/opkg-bash-completion
> @@ -0,0 +1,26 @@
> +#!/bin/bash
> +
> +# TBD: parse "opkg --help" to get this list
> +OPKG_COMMANDS="update upgrade install configure remove clean flag list list-installed list-upgradable list-changed-conffiles files search find info status download compare-versions print-architecture depends whatdepends whatdependsrec whatrecommends whatsuggests whatprovides whatconflicts whatreplaces"
> +
> +_opkg_completions() {
> +    if [ ${#COMP_WORDS[@]} -eq 2 ]
> +    then
> +        COMPREPLY=($(compgen -W "${OPKG_COMMANDS}" "${COMP_WORDS[1]}"))
> +        return
> +    fi
> +
> +    # TBD: add more cases, support options
> +    case "${COMP_WORDS[1]}" in
> +        install|files|info|status|download)
> +            COMPREPLY=($(compgen -W "$(opkg list | sed -e 's| .*$||')" -- "${COMP_WORDS[$COMP_CWORD]}"));;
> +        depends|whatdepends|whatdependsrec|whatrecommends|whatsuggests|whatprovides|whatconflicts|whatreplaces)
> +            COMPREPLY=($(compgen -W "-A $(opkg list | sed -e 's| .*$||')" -- "${COMP_WORDS[$COMP_CWORD]}"));;
> +        remove)
> +            COMPREPLY=($(compgen -W "$(opkg list-installed | sed -e 's| .*$||')" -- "${COMP_WORDS[$COMP_CWORD]}"));;
> +        upgrade)
> +            COMPREPLY=($(compgen -W "$(opkg list-upgradable | sed -e 's| .*$||')" -- "${COMP_WORDS[$COMP_CWORD]}"));;
> +    esac
> +}
> +
> +complete -F _opkg_completions opkg
> -- 
> 2.7.4
> 
> _______________________________________________
> meta-arago mailing list
> meta-arago@arago-project.org
> http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago


      parent reply	other threads:[~2020-01-21 20:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-21 16:58 [RFC][PATCH 1/2] opkg-bash-completion: add simple completions for opkg Jacob Stiffler
2020-01-21 16:58 ` [RFC][PATCH 2/2] packagegroup-arago-base: add opkg-bash-completion Jacob Stiffler
2020-01-21 20:32 ` Denys Dmytriyenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200121203252.GE31036@beryl \
    --to=denys@ti.com \
    --cc=j-stiffler@ti.com \
    --cc=meta-arago@arago-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.