All of lore.kernel.org
 help / color / mirror / Atom feed
* [] Add files supporting bash completion for bitbake tools
@ 2018-09-01 13:36 Łukasz Gardoń
  2018-09-01 19:33 ` Alexander Kanavin
  0 siblings, 1 reply; 7+ messages in thread
From: Łukasz Gardoń @ 2018-09-01 13:36 UTC (permalink / raw)
  To: bitbake-devel

Repository with more details:
https://github.com/lukaszgard/bitbake-completion

Signed-off-by: Łukasz Gardoń <lukaszgardon555@gmail.com>
---
 contrib/completion/bash/bitbake_completion    | 108 ++++++++++
 .../bash/bitbake_diffsigs_completion          |  86 ++++++++
 .../bash/bitbake_dumpsig_completion           |  89 +++++++++
 .../completion/bash/bitbake_layers_completion | 188 ++++++++++++++++++
 .../completion/bash/bitbake_prserv_completion |  76 +++++++
 .../bash/bitbake_selftest_completion          |  34 ++++
 6 files changed, 581 insertions(+)
 create mode 100644 contrib/completion/bash/bitbake_completion
 create mode 100644 contrib/completion/bash/bitbake_diffsigs_completion
 create mode 100644 contrib/completion/bash/bitbake_dumpsig_completion
 create mode 100644 contrib/completion/bash/bitbake_layers_completion
 create mode 100644 contrib/completion/bash/bitbake_prserv_completion
 create mode 100644 contrib/completion/bash/bitbake_selftest_completion

diff --git a/contrib/completion/bash/bitbake_completion b/contrib/completion/bash/bitbake_completion
new file mode 100644
index 00000000..23cadf6e
--- /dev/null
+++ b/contrib/completion/bash/bitbake_completion
@@ -0,0 +1,108 @@
+#!bash
+# Bash completion support for bitbake 1.39.1 release.
+#
+# Copyright (C) 2014 Sergio Prado <sergio.prado@e-labworks.com>
+# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake()
+{
+    local cur prev opts_short opts_long tasks recipes ui
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -b -k -f -c -C -r -R -v -D -q -n -S -p -s -e -g -I \
+                -l -P -u -B -T -m -w"
+
+    opts_long="--version --help --buildfile= --continue --force --cmd= \
+               --clear-stamp= --read= --postread= --verbose --debug --quiet \
+               --dry-run --dump-signatures= --parse-only --show-versions \
+               --environment --graphviz --ignore-deps= --log-domains= --profile \
+               --ui= --token= --revisions-changed --server-only --bind= \
+               --idle-timeout= --no-setscene --setscene-only --remote-server= \
+               --kill-server --observe-only --status-only --write-log= --runall= \
+               --runonly="
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base deploy \
+           distrodata fetch image image_complete install install_ptest_base package \
+           package_qa package_write_deb package_write_ipk package_write_rpm package_write_tar \
+           packagedata patch populate_lic populate_sdk populate_sysroot prepare_recipe_sysroot \
+           rm_work rm_work_all unpack checkpkg checkuri clean cleanall cleansstate devpyshell \
+           devshell listtasks package_index bootimg bundle_initramfs rootfs testimage \
+           testimage_auto compile_kernelmodules diffconfig kernel_checkout kernel_configcheck \
+           kernel_configme kernel_menuconfig kernel_metadata menuconfig savedefconfig shared_workdir \
+           sizecheck strip validate_branches spdx"
+
+    ui="knotty ncurses taskexp"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD - 2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    conf_files=$(find . -maxdepth 1 -name "*.conf" -type f -printf '%P\n')
+
+    case "$prev" in
+        "-c"|"--cmd"|"-C"|"--clear-stamp"|"--ignore-deps"|"--runall"|"--runonly")
+            COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+            return 0
+        ;;
+        "-r"|"--read"|"-R"|"--postread")
+            COMPREPLY=( $(compgen -W "${conf_files}" -- ${cur}) )
+            return 0
+        ;;
+        "-u"|"--ui")
+            COMPREPLY=( $(compgen -W "${ui}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ; then
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' | awk '{print $1}' > $bb_recipes
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+        _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+         md5sum $bb_layers_conf > $bb_layers_md5
+         _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+    return 0
+}
+complete -F _bitbake bitbake
\ No newline at end of file
diff --git a/contrib/completion/bash/bitbake_diffsigs_completion b/contrib/completion/bash/bitbake_diffsigs_completion
new file mode 100644
index 00000000..cbf2c5f1
--- /dev/null
+++ b/contrib/completion/bash/bitbake_diffsigs_completion
@@ -0,0 +1,86 @@
+#!bash
+# Bash completion support for bitbake-diffsigs tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_diffsigs()
+{
+    local cur prev opts_short opts_long tasks colors
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -d -t -s"
+
+    opts_long="--help --debug --color --task --signature"
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base deploy \
+           distrodata fetch image image_complete install install_ptest_base package \
+           package_qa package_write_deb package_write_ipk package_write_rpm package_write_tar \
+           packagedata patch populate_lic populate_sdk populate_sysroot prepare_recipe_sysroot \
+           rm_work rm_work_all unpack checkpkg checkuri clean cleanall cleansstate devpyshell \
+           devshell listtasks package_index bootimg bundle_initramfs rootfs testimage \
+           testimage_auto compile_kernelmodules diffconfig kernel_checkout kernel_configcheck \
+           kernel_configme kernel_menuconfig kernel_metadata menuconfig savedefconfig shared_workdir \
+           sizecheck strip validate_branches spdx"
+
+    colors="auto always never"
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' | awk '{print $1}' > $bb_recipes
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+	    _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+        md5sum $bb_layers_conf > $bb_layers_md5
+        _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    case "$prev" in
+        "-c"|"--color")
+            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
+            return 0
+        ;;
+        "-t"|"--task")
+	   COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+	   return 0
+    esac
+
+    if [[ ${COMP_WORDS[COMP_CWORD -2]} == "-t" ]] || [[ ${COMP_WORDS[COMP_CWORD -2]} == "--task" ]]; then 
+        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+	    return 0
+    fi
+}
+complete -F _bitbake_diffsigs bitbake-diffsigs
\ No newline at end of file
diff --git a/contrib/completion/bash/bitbake_dumpsig_completion b/contrib/completion/bash/bitbake_dumpsig_completion
new file mode 100644
index 00000000..95eb2394
--- /dev/null
+++ b/contrib/completion/bash/bitbake_dumpsig_completion
@@ -0,0 +1,89 @@
+#!bash
+# Bash completion support for bitbake-dumpsig tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_dumpsig()
+{
+    local cur prev opts_short opts_long tasks
+    local bb_layers_conf bb_layers_md5 bb_recipes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -d -t"
+
+    opts_long="--help --debug --task="
+
+    tasks="build compile compile_ptest_base configure configure_ptest_base deploy \
+           distrodata fetch image image_complete install install_ptest_base package \
+           package_qa package_write_deb package_write_ipk package_write_rpm package_write_tar \
+           packagedata patch populate_lic populate_sdk populate_sysroot prepare_recipe_sysroot \
+           rm_work rm_work_all unpack checkpkg checkuri clean cleanall cleansstate devpyshell \
+           devshell listtasks package_index bootimg bundle_initramfs rootfs testimage \
+           testimage_auto compile_kernelmodules diffconfig kernel_checkout kernel_configcheck \
+           kernel_configme kernel_menuconfig kernel_metadata menuconfig savedefconfig shared_workdir \
+           sizecheck strip validate_branches spdx"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD - 2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ; then
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    bb_layers_conf="conf/bblayers.conf"
+    bb_layers_md5=".bb_layers_conf.md5"
+    bb_recipes=".bb_recipes"
+
+    _parse_recipes () {
+        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' | awk '{print $1}' > $bb_recipes    
+    }
+
+    if [ ! -e $bb_layers_conf ]; then
+        return 0
+    fi
+
+    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
+	    _parse_recipes
+    fi
+
+    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
+    if [ $? != 0 -o ! -e $bb_recipes ]; then
+        md5sum $bb_layers_conf > $bb_layers_md5
+        _parse_recipes
+    fi
+
+    recipes=$(cat $bb_recipes)
+
+    case "$prev" in
+        "-t"|"--task")
+	    COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
+	    return 0
+    esac
+
+    if [[ ${COMP_WORDS[COMP_CWORD -2]} =~ "-t" ]] || [[ ${COMP_WORDS[COMP_CWORD -3]} == "--task" ]]; then 
+        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
+	    return 0
+    fi
+}
+complete -F _bitbake_dumpsig bitbake-dumpsig
\ No newline at end of file
diff --git a/contrib/completion/bash/bitbake_layers_completion b/contrib/completion/bash/bitbake_layers_completion
new file mode 100644
index 00000000..37ca8afb
--- /dev/null
+++ b/contrib/completion/bash/bitbake_layers_completion
@@ -0,0 +1,188 @@
+#!bash
+# Bash completion support for bitbake-layers tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_layers()
+{
+    local cur prev opts_short opts_long subcommands colors
+    local opts_long_add_layer opts_short_add_layer opts_long_show_overlayed
+    local opts_short_show_overlayed opts_long_show_recipes opts_short_show_recipes
+    local opts_long_show_cross_depends opts_short_show_cross_depends
+    local opts_long_show_layerindex_fetch opts_short_show_layerindex_fetch
+    local opts_long_show_layerindex_show_depends opts_short_show_layerindex_show_depends
+    local opts_long_show_create_layer opts_short_show_create_layer bb_class_files classes
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-d -q -F -h"
+
+    opts_long="--debug --quiet --force --color --help"
+
+    subcommands="layerindex-fetch layerindex-show-depends add-layer \
+	             remove-layer flatten show-layers show-overlayed \
+		         show-recipes show-appends show-cross-depends \
+		         create-layer"
+
+    colors="auto always never" 
+
+    opts_long_show_overlayed="--help --filenames --same-version"
+    opts_short_show_overlayed="-h -f -s"
+
+    opts_long_show_recipes="--help --filenames --multiple --inherits"
+    opts_short_show_recipes="-h -f -m -i"
+
+    opts_long_show_layerindex_fetch="--help --show-only --branch --ignore"
+    opts_short_show_layerindex_fetch="-h -n -b -i"
+
+    opts_long_add_layer="--help --priority --example-recipe-name --example-recipe-version"
+    opts_short_add_layer="-h"
+
+    opts_long_show_cross_depends="--help --filenames --ignore"
+    opts_short_show_cross_depends="-h -f -i"
+
+    opts_long_show_layerindex_show_depends="--help --branch"
+    opts_short_show_layerindex_show_depends="-h -b"
+
+    opts_long_show_create_layer="--help --priority --example-recipe-name --example-recipe-version"
+    opts_short_show_create_layer="-h -p -e -v"
+
+    bb_class_files=".bb_class_files"
+
+    _get_classes() {
+        find $BBPATH/../meta*/classes/ -name *.bbclass -exec basename {} \; | sed 's/.bbclass//' > $bb_class_files
+    }
+
+    if [[ "${COMP_WORDS[@]}" =~ show-recipes ]] ; then
+        if [[ "$prev" == "--inherits" ]] || [[ "$prev" == "-i" ]]; then
+            _get_classes
+            classes=$(cat $bb_class_files)
+            COMPREPLY=( $(compgen -W "${classes}" -- ${cur}) )
+            return 0
+        fi
+    fi
+
+    if [[ "${COMP_WORDS[1]}" =~ show-layers|show-appends|remove-layer|flatten ]]; then
+        case "$cur" in
+            "--"*)
+                COMPREPLY=( $(compgen -W "--help" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "-h" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "add-layer" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_add_layer}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_add_layer}" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-overlayed" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_overlayed}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_overlayed}" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-recipes" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_recipes}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_recipes}" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "show-cross-depends" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_cross_depends}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_cross_depends}" -- ${cur}) )
+                return 0
+            ;;
+        esac    
+    elif [[ "${COMP_WORDS[1]}" == "layerindex-fetch" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_layerindex_fetch}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_layerindex_fetch}" -- ${cur}) )
+                return 0
+            ;;
+        esac    
+    elif [[ "${COMP_WORDS[1]}" == "layerindex-show-depends" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_layerindex_show_depends}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_layerindex_show_depends}" -- ${cur}) )
+                return 0
+            ;;
+        esac
+    elif [[ "${COMP_WORDS[1]}" == "create-layer" ]]; then
+        case "$cur" in
+            "--"*|"")
+                COMPREPLY=( $(compgen -W "${opts_long_show_create_layer}" -- ${cur}) )
+                return 0
+            ;;
+            "-"*)
+                COMPREPLY=( $(compgen -W "${opts_short_show_create_layer}" -- ${cur}) )
+                return 0
+            ;;
+        esac                          
+    fi
+
+    case "$prev" in
+        "-c"|"--color")
+            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    if [[ ${prev} == "bitbake-layers" ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    fi
+}
+complete -F _bitbake_layers bitbake-layers
\ No newline at end of file
diff --git a/contrib/completion/bash/bitbake_prserv_completion b/contrib/completion/bash/bitbake_prserv_completion
new file mode 100644
index 00000000..3bca1197
--- /dev/null
+++ b/contrib/completion/bash/bitbake_prserv_completion
@@ -0,0 +1,76 @@
+#!bash
+# Bash completion support for bitbake-prserv tool,
+# compatible with Bitbake 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_prserv()
+{
+    local cur prev opts_short opts_long subcommands file_default log_default log_levels
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -f -l"
+
+    opts_long="--version --help --file= --log= --loglevel= --start \
+	           --stop --host= --port="
+
+    subcommands="layerindex-fetch layerindex-show-depends add-layer \
+	             remove-layer flatten show-layers show-overlayed \
+		         show-recipes show-appends show-cross-depends \
+		         create-layer"
+
+    file_default="prserv.sqlite3"
+    log_default="prserv.log"
+    log_levels="CRITICAL ERROR WARNING INFO DEBUG"
+
+    if [[ "$prev" == "=" ]]; then
+        prev="${COMP_WORDS[COMP_CWORD -2]}"
+    elif [[ "$cur" == "=" ]]; then
+        cur=""
+    fi
+
+    case "$prev" in
+        "-f"|"--file")
+            COMPREPLY=( $(compgen -W "${file_default}" -- ${cur}) )
+            return 0
+        ;;
+        "-l"|"--log")
+            COMPREPLY=( $(compgen -W "${log_default}" -- ${cur}) )
+            return 0
+        ;;
+        "--loglevel")
+            COMPREPLY=( $(compgen -W "${log_levels}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    case "$cur" in
+        "--"*|"")
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ; then
+                compopt -o nospace
+            fi
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+
+    if [[ ${prev} == "bitbake-layers" ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
+        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
+        return 0
+    fi
+}
+complete -F _bitbake_prserv bitbake-prserv
\ No newline at end of file
diff --git a/contrib/completion/bash/bitbake_selftest_completion b/contrib/completion/bash/bitbake_selftest_completion
new file mode 100644
index 00000000..8b6bf641
--- /dev/null
+++ b/contrib/completion/bash/bitbake_selftest_completion
@@ -0,0 +1,34 @@
+#!bash
+# Bash completion support for bitbake-selftest tool,
+# compatible with Bitbake version 1.39.1.
+#
+# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
+#
+# Distributed under the MIT License (MIT)
+#
+
+_bitbake_selftest()
+{
+    local cur prev opts_short opts_long
+
+    COMPREPLY=()
+
+    cur="${COMP_WORDS[COMP_CWORD]}"
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+
+    opts_short="-h -v -q -f -c"
+
+    opts_long="--help --verbose --quiet --locals --failfast --catch"
+
+    case "$cur" in
+        "--"*)
+            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
+            return 0
+        ;;
+        "-"*)
+            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
+            return 0
+        ;;
+    esac
+}
+complete -F _bitbake_selftest bitbake-selftest
\ No newline at end of file
-- 
2.18.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [] Add files supporting bash completion for bitbake tools
  2018-09-01 13:36 [] Add files supporting bash completion for bitbake tools Łukasz Gardoń
@ 2018-09-01 19:33 ` Alexander Kanavin
       [not found]   ` <94B3180E-9326-43AC-9780-39A3E2D9F850@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Kanavin @ 2018-09-01 19:33 UTC (permalink / raw)
  To: Łukasz Gardoń; +Cc: bitbake-devel

The right upstream destination for this is almost certainly
https://github.com/scop/bash-completion

Alex

2018-09-01 15:36 GMT+02:00 Łukasz Gardoń <lukaszgardon555@gmail.com>:
> Repository with more details:
> https://github.com/lukaszgard/bitbake-completion
>
> Signed-off-by: Łukasz Gardoń <lukaszgardon555@gmail.com>
> ---
>  contrib/completion/bash/bitbake_completion    | 108 ++++++++++
>  .../bash/bitbake_diffsigs_completion          |  86 ++++++++
>  .../bash/bitbake_dumpsig_completion           |  89 +++++++++
>  .../completion/bash/bitbake_layers_completion | 188 ++++++++++++++++++
>  .../completion/bash/bitbake_prserv_completion |  76 +++++++
>  .../bash/bitbake_selftest_completion          |  34 ++++
>  6 files changed, 581 insertions(+)
>  create mode 100644 contrib/completion/bash/bitbake_completion
>  create mode 100644 contrib/completion/bash/bitbake_diffsigs_completion
>  create mode 100644 contrib/completion/bash/bitbake_dumpsig_completion
>  create mode 100644 contrib/completion/bash/bitbake_layers_completion
>  create mode 100644 contrib/completion/bash/bitbake_prserv_completion
>  create mode 100644 contrib/completion/bash/bitbake_selftest_completion
>
> diff --git a/contrib/completion/bash/bitbake_completion b/contrib/completion/bash/bitbake_completion
> new file mode 100644
> index 00000000..23cadf6e
> --- /dev/null
> +++ b/contrib/completion/bash/bitbake_completion
> @@ -0,0 +1,108 @@
> +#!bash
> +# Bash completion support for bitbake 1.39.1 release.
> +#
> +# Copyright (C) 2014 Sergio Prado <sergio.prado@e-labworks.com>
> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
> +#
> +# Distributed under the MIT License (MIT)
> +#
> +
> +_bitbake()
> +{
> +    local cur prev opts_short opts_long tasks recipes ui
> +    local bb_layers_conf bb_layers_md5 bb_recipes
> +
> +    COMPREPLY=()
> +
> +    cur="${COMP_WORDS[COMP_CWORD]}"
> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
> +
> +    opts_short="-h -b -k -f -c -C -r -R -v -D -q -n -S -p -s -e -g -I \
> +                -l -P -u -B -T -m -w"
> +
> +    opts_long="--version --help --buildfile= --continue --force --cmd= \
> +               --clear-stamp= --read= --postread= --verbose --debug --quiet \
> +               --dry-run --dump-signatures= --parse-only --show-versions \
> +               --environment --graphviz --ignore-deps= --log-domains= --profile \
> +               --ui= --token= --revisions-changed --server-only --bind= \
> +               --idle-timeout= --no-setscene --setscene-only --remote-server= \
> +               --kill-server --observe-only --status-only --write-log= --runall= \
> +               --runonly="
> +
> +    tasks="build compile compile_ptest_base configure configure_ptest_base deploy \
> +           distrodata fetch image image_complete install install_ptest_base package \
> +           package_qa package_write_deb package_write_ipk package_write_rpm package_write_tar \
> +           packagedata patch populate_lic populate_sdk populate_sysroot prepare_recipe_sysroot \
> +           rm_work rm_work_all unpack checkpkg checkuri clean cleanall cleansstate devpyshell \
> +           devshell listtasks package_index bootimg bundle_initramfs rootfs testimage \
> +           testimage_auto compile_kernelmodules diffconfig kernel_checkout kernel_configcheck \
> +           kernel_configme kernel_menuconfig kernel_metadata menuconfig savedefconfig shared_workdir \
> +           sizecheck strip validate_branches spdx"
> +
> +    ui="knotty ncurses taskexp"
> +
> +    if [[ "$prev" == "=" ]]; then
> +        prev="${COMP_WORDS[COMP_CWORD - 2]}"
> +    elif [[ "$cur" == "=" ]]; then
> +        cur=""
> +    fi
> +
> +    conf_files=$(find . -maxdepth 1 -name "*.conf" -type f -printf '%P\n')
> +
> +    case "$prev" in
> +        "-c"|"--cmd"|"-C"|"--clear-stamp"|"--ignore-deps"|"--runall"|"--runonly")
> +            COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-r"|"--read"|"-R"|"--postread")
> +            COMPREPLY=( $(compgen -W "${conf_files}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-u"|"--ui")
> +            COMPREPLY=( $(compgen -W "${ui}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    case "$cur" in
> +        "--"*)
> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
> +            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ; then
> +                compopt -o nospace
> +            fi
> +            return 0
> +        ;;
> +        "-"*)
> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    bb_layers_conf="conf/bblayers.conf"
> +    bb_layers_md5=".bb_layers_conf.md5"
> +    bb_recipes=".bb_recipes"
> +
> +    _parse_recipes () {
> +        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' | awk '{print $1}' > $bb_recipes
> +    }
> +
> +    if [ ! -e $bb_layers_conf ]; then
> +        return 0
> +    fi
> +
> +    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
> +        _parse_recipes
> +    fi
> +
> +    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
> +    if [ $? != 0 -o ! -e $bb_recipes ]; then
> +         md5sum $bb_layers_conf > $bb_layers_md5
> +         _parse_recipes
> +    fi
> +
> +    recipes=$(cat $bb_recipes)
> +
> +    COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
> +    return 0
> +}
> +complete -F _bitbake bitbake
> \ No newline at end of file
> diff --git a/contrib/completion/bash/bitbake_diffsigs_completion b/contrib/completion/bash/bitbake_diffsigs_completion
> new file mode 100644
> index 00000000..cbf2c5f1
> --- /dev/null
> +++ b/contrib/completion/bash/bitbake_diffsigs_completion
> @@ -0,0 +1,86 @@
> +#!bash
> +# Bash completion support for bitbake-diffsigs tool,
> +# compatible with Bitbake 1.39.1.
> +#
> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
> +#
> +# Distributed under the MIT License (MIT)
> +#
> +
> +_bitbake_diffsigs()
> +{
> +    local cur prev opts_short opts_long tasks colors
> +    local bb_layers_conf bb_layers_md5 bb_recipes
> +
> +    COMPREPLY=()
> +
> +    cur="${COMP_WORDS[COMP_CWORD]}"
> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
> +
> +    opts_short="-h -d -t -s"
> +
> +    opts_long="--help --debug --color --task --signature"
> +
> +    tasks="build compile compile_ptest_base configure configure_ptest_base deploy \
> +           distrodata fetch image image_complete install install_ptest_base package \
> +           package_qa package_write_deb package_write_ipk package_write_rpm package_write_tar \
> +           packagedata patch populate_lic populate_sdk populate_sysroot prepare_recipe_sysroot \
> +           rm_work rm_work_all unpack checkpkg checkuri clean cleanall cleansstate devpyshell \
> +           devshell listtasks package_index bootimg bundle_initramfs rootfs testimage \
> +           testimage_auto compile_kernelmodules diffconfig kernel_checkout kernel_configcheck \
> +           kernel_configme kernel_menuconfig kernel_metadata menuconfig savedefconfig shared_workdir \
> +           sizecheck strip validate_branches spdx"
> +
> +    colors="auto always never"
> +
> +    case "$cur" in
> +        "--"*)
> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-"*)
> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    bb_layers_conf="conf/bblayers.conf"
> +    bb_layers_md5=".bb_layers_conf.md5"
> +    bb_recipes=".bb_recipes"
> +
> +    _parse_recipes () {
> +        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' | awk '{print $1}' > $bb_recipes
> +    }
> +
> +    if [ ! -e $bb_layers_conf ]; then
> +        return 0
> +    fi
> +
> +    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
> +           _parse_recipes
> +    fi
> +
> +    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
> +    if [ $? != 0 -o ! -e $bb_recipes ]; then
> +        md5sum $bb_layers_conf > $bb_layers_md5
> +        _parse_recipes
> +    fi
> +
> +    recipes=$(cat $bb_recipes)
> +
> +    case "$prev" in
> +        "-c"|"--color")
> +            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-t"|"--task")
> +          COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
> +          return 0
> +    esac
> +
> +    if [[ ${COMP_WORDS[COMP_CWORD -2]} == "-t" ]] || [[ ${COMP_WORDS[COMP_CWORD -2]} == "--task" ]]; then
> +        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
> +           return 0
> +    fi
> +}
> +complete -F _bitbake_diffsigs bitbake-diffsigs
> \ No newline at end of file
> diff --git a/contrib/completion/bash/bitbake_dumpsig_completion b/contrib/completion/bash/bitbake_dumpsig_completion
> new file mode 100644
> index 00000000..95eb2394
> --- /dev/null
> +++ b/contrib/completion/bash/bitbake_dumpsig_completion
> @@ -0,0 +1,89 @@
> +#!bash
> +# Bash completion support for bitbake-dumpsig tool,
> +# compatible with Bitbake 1.39.1.
> +#
> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
> +#
> +# Distributed under the MIT License (MIT)
> +#
> +
> +_bitbake_dumpsig()
> +{
> +    local cur prev opts_short opts_long tasks
> +    local bb_layers_conf bb_layers_md5 bb_recipes
> +
> +    COMPREPLY=()
> +
> +    cur="${COMP_WORDS[COMP_CWORD]}"
> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
> +
> +    opts_short="-h -d -t"
> +
> +    opts_long="--help --debug --task="
> +
> +    tasks="build compile compile_ptest_base configure configure_ptest_base deploy \
> +           distrodata fetch image image_complete install install_ptest_base package \
> +           package_qa package_write_deb package_write_ipk package_write_rpm package_write_tar \
> +           packagedata patch populate_lic populate_sdk populate_sysroot prepare_recipe_sysroot \
> +           rm_work rm_work_all unpack checkpkg checkuri clean cleanall cleansstate devpyshell \
> +           devshell listtasks package_index bootimg bundle_initramfs rootfs testimage \
> +           testimage_auto compile_kernelmodules diffconfig kernel_checkout kernel_configcheck \
> +           kernel_configme kernel_menuconfig kernel_metadata menuconfig savedefconfig shared_workdir \
> +           sizecheck strip validate_branches spdx"
> +
> +    if [[ "$prev" == "=" ]]; then
> +        prev="${COMP_WORDS[COMP_CWORD - 2]}"
> +    elif [[ "$cur" == "=" ]]; then
> +        cur=""
> +    fi
> +
> +    case "$cur" in
> +        "--"*)
> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
> +            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ; then
> +                compopt -o nospace
> +            fi
> +            return 0
> +        ;;
> +        "-"*)
> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    bb_layers_conf="conf/bblayers.conf"
> +    bb_layers_md5=".bb_layers_conf.md5"
> +    bb_recipes=".bb_recipes"
> +
> +    _parse_recipes () {
> +        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' | awk '{print $1}' > $bb_recipes
> +    }
> +
> +    if [ ! -e $bb_layers_conf ]; then
> +        return 0
> +    fi
> +
> +    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
> +           _parse_recipes
> +    fi
> +
> +    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
> +    if [ $? != 0 -o ! -e $bb_recipes ]; then
> +        md5sum $bb_layers_conf > $bb_layers_md5
> +        _parse_recipes
> +    fi
> +
> +    recipes=$(cat $bb_recipes)
> +
> +    case "$prev" in
> +        "-t"|"--task")
> +           COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
> +           return 0
> +    esac
> +
> +    if [[ ${COMP_WORDS[COMP_CWORD -2]} =~ "-t" ]] || [[ ${COMP_WORDS[COMP_CWORD -3]} == "--task" ]]; then
> +        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
> +           return 0
> +    fi
> +}
> +complete -F _bitbake_dumpsig bitbake-dumpsig
> \ No newline at end of file
> diff --git a/contrib/completion/bash/bitbake_layers_completion b/contrib/completion/bash/bitbake_layers_completion
> new file mode 100644
> index 00000000..37ca8afb
> --- /dev/null
> +++ b/contrib/completion/bash/bitbake_layers_completion
> @@ -0,0 +1,188 @@
> +#!bash
> +# Bash completion support for bitbake-layers tool,
> +# compatible with Bitbake 1.39.1.
> +#
> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
> +#
> +# Distributed under the MIT License (MIT)
> +#
> +
> +_bitbake_layers()
> +{
> +    local cur prev opts_short opts_long subcommands colors
> +    local opts_long_add_layer opts_short_add_layer opts_long_show_overlayed
> +    local opts_short_show_overlayed opts_long_show_recipes opts_short_show_recipes
> +    local opts_long_show_cross_depends opts_short_show_cross_depends
> +    local opts_long_show_layerindex_fetch opts_short_show_layerindex_fetch
> +    local opts_long_show_layerindex_show_depends opts_short_show_layerindex_show_depends
> +    local opts_long_show_create_layer opts_short_show_create_layer bb_class_files classes
> +
> +    COMPREPLY=()
> +
> +    cur="${COMP_WORDS[COMP_CWORD]}"
> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
> +
> +    opts_short="-d -q -F -h"
> +
> +    opts_long="--debug --quiet --force --color --help"
> +
> +    subcommands="layerindex-fetch layerindex-show-depends add-layer \
> +                    remove-layer flatten show-layers show-overlayed \
> +                        show-recipes show-appends show-cross-depends \
> +                        create-layer"
> +
> +    colors="auto always never"
> +
> +    opts_long_show_overlayed="--help --filenames --same-version"
> +    opts_short_show_overlayed="-h -f -s"
> +
> +    opts_long_show_recipes="--help --filenames --multiple --inherits"
> +    opts_short_show_recipes="-h -f -m -i"
> +
> +    opts_long_show_layerindex_fetch="--help --show-only --branch --ignore"
> +    opts_short_show_layerindex_fetch="-h -n -b -i"
> +
> +    opts_long_add_layer="--help --priority --example-recipe-name --example-recipe-version"
> +    opts_short_add_layer="-h"
> +
> +    opts_long_show_cross_depends="--help --filenames --ignore"
> +    opts_short_show_cross_depends="-h -f -i"
> +
> +    opts_long_show_layerindex_show_depends="--help --branch"
> +    opts_short_show_layerindex_show_depends="-h -b"
> +
> +    opts_long_show_create_layer="--help --priority --example-recipe-name --example-recipe-version"
> +    opts_short_show_create_layer="-h -p -e -v"
> +
> +    bb_class_files=".bb_class_files"
> +
> +    _get_classes() {
> +        find $BBPATH/../meta*/classes/ -name *.bbclass -exec basename {} \; | sed 's/.bbclass//' > $bb_class_files
> +    }
> +
> +    if [[ "${COMP_WORDS[@]}" =~ show-recipes ]] ; then
> +        if [[ "$prev" == "--inherits" ]] || [[ "$prev" == "-i" ]]; then
> +            _get_classes
> +            classes=$(cat $bb_class_files)
> +            COMPREPLY=( $(compgen -W "${classes}" -- ${cur}) )
> +            return 0
> +        fi
> +    fi
> +
> +    if [[ "${COMP_WORDS[1]}" =~ show-layers|show-appends|remove-layer|flatten ]]; then
> +        case "$cur" in
> +            "--"*)
> +                COMPREPLY=( $(compgen -W "--help" -- ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "-h" -- ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "add-layer" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W "${opts_long_add_layer}" -- ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "${opts_short_add_layer}" -- ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "show-overlayed" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W "${opts_long_show_overlayed}" -- ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "${opts_short_show_overlayed}" -- ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "show-recipes" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W "${opts_long_show_recipes}" -- ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "${opts_short_show_recipes}" -- ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "show-cross-depends" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W "${opts_long_show_cross_depends}" -- ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "${opts_short_show_cross_depends}" -- ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "layerindex-fetch" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W "${opts_long_show_layerindex_fetch}" -- ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "${opts_short_show_layerindex_fetch}" -- ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "layerindex-show-depends" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W "${opts_long_show_layerindex_show_depends}" -- ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "${opts_short_show_layerindex_show_depends}" -- ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "create-layer" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W "${opts_long_show_create_layer}" -- ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "${opts_short_show_create_layer}" -- ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    fi
> +
> +    case "$prev" in
> +        "-c"|"--color")
> +            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    case "$cur" in
> +        "--"*)
> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-"*)
> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    if [[ ${prev} == "bitbake-layers" ]]; then
> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
> +        return 0
> +    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
> +        return 0
> +    fi
> +}
> +complete -F _bitbake_layers bitbake-layers
> \ No newline at end of file
> diff --git a/contrib/completion/bash/bitbake_prserv_completion b/contrib/completion/bash/bitbake_prserv_completion
> new file mode 100644
> index 00000000..3bca1197
> --- /dev/null
> +++ b/contrib/completion/bash/bitbake_prserv_completion
> @@ -0,0 +1,76 @@
> +#!bash
> +# Bash completion support for bitbake-prserv tool,
> +# compatible with Bitbake 1.39.1.
> +#
> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
> +#
> +# Distributed under the MIT License (MIT)
> +#
> +
> +_bitbake_prserv()
> +{
> +    local cur prev opts_short opts_long subcommands file_default log_default log_levels
> +
> +    COMPREPLY=()
> +
> +    cur="${COMP_WORDS[COMP_CWORD]}"
> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
> +
> +    opts_short="-h -f -l"
> +
> +    opts_long="--version --help --file= --log= --loglevel= --start \
> +                  --stop --host= --port="
> +
> +    subcommands="layerindex-fetch layerindex-show-depends add-layer \
> +                    remove-layer flatten show-layers show-overlayed \
> +                        show-recipes show-appends show-cross-depends \
> +                        create-layer"
> +
> +    file_default="prserv.sqlite3"
> +    log_default="prserv.log"
> +    log_levels="CRITICAL ERROR WARNING INFO DEBUG"
> +
> +    if [[ "$prev" == "=" ]]; then
> +        prev="${COMP_WORDS[COMP_CWORD -2]}"
> +    elif [[ "$cur" == "=" ]]; then
> +        cur=""
> +    fi
> +
> +    case "$prev" in
> +        "-f"|"--file")
> +            COMPREPLY=( $(compgen -W "${file_default}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-l"|"--log")
> +            COMPREPLY=( $(compgen -W "${log_default}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "--loglevel")
> +            COMPREPLY=( $(compgen -W "${log_levels}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    case "$cur" in
> +        "--"*|"")
> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
> +            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ; then
> +                compopt -o nospace
> +            fi
> +            return 0
> +        ;;
> +        "-"*)
> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    if [[ ${prev} == "bitbake-layers" ]]; then
> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
> +        return 0
> +    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
> +        return 0
> +    fi
> +}
> +complete -F _bitbake_prserv bitbake-prserv
> \ No newline at end of file
> diff --git a/contrib/completion/bash/bitbake_selftest_completion b/contrib/completion/bash/bitbake_selftest_completion
> new file mode 100644
> index 00000000..8b6bf641
> --- /dev/null
> +++ b/contrib/completion/bash/bitbake_selftest_completion
> @@ -0,0 +1,34 @@
> +#!bash
> +# Bash completion support for bitbake-selftest tool,
> +# compatible with Bitbake version 1.39.1.
> +#
> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
> +#
> +# Distributed under the MIT License (MIT)
> +#
> +
> +_bitbake_selftest()
> +{
> +    local cur prev opts_short opts_long
> +
> +    COMPREPLY=()
> +
> +    cur="${COMP_WORDS[COMP_CWORD]}"
> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
> +
> +    opts_short="-h -v -q -f -c"
> +
> +    opts_long="--help --verbose --quiet --locals --failfast --catch"
> +
> +    case "$cur" in
> +        "--"*)
> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-"*)
> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +}
> +complete -F _bitbake_selftest bitbake-selftest
> \ No newline at end of file
> --
> 2.18.0
>
> --
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Add files supporting bash completion for bitbake tools
       [not found]   ` <94B3180E-9326-43AC-9780-39A3E2D9F850@gmail.com>
@ 2018-09-03  9:25     ` Alexander Kanavin
       [not found]       ` <1577859A-5F16-4E3F-8C23-1ECB099AB770@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Kanavin @ 2018-09-03  9:25 UTC (permalink / raw)
  To: Łukasz Gardoń, bitbake-devel

Hello Lukasz,

nobody will find your contributions in bitbake/contrib, and so they
will be unused and will bitrot. The proper place is the upstream
bash-completion project, which will get picked up by all Linux
distributions.

Alex

2018-09-02 12:27 GMT+02:00 Łukasz Gardoń <lukaszgardon555@gmail.com>:
> Hi Alex,
>
> With information comes file from bitbake repository -
> bitbake/contrib/README: "This directory is for additional contributed files
> which may be useful.”.
> I think that this is proper place for such files.
>
> Wiadomość napisana przez Alexander Kanavin <alex.kanavin@gmail.com> w dniu
> 01.09.2018, o godz. 21:33:
>
> The right upstream destination for this is almost certainly
> https://github.com/scop/bash-completion
>
> Alex
>
> 2018-09-01 15:36 GMT+02:00 Łukasz Gardoń <lukaszgardon555@gmail.com>:
>
> Repository with more details:
> https://github.com/lukaszgard/bitbake-completion
>
> Signed-off-by: Łukasz Gardoń <lukaszgardon555@gmail.com>
> ---
> contrib/completion/bash/bitbake_completion    | 108 ++++++++++
> .../bash/bitbake_diffsigs_completion          |  86 ++++++++
> .../bash/bitbake_dumpsig_completion           |  89 +++++++++
> .../completion/bash/bitbake_layers_completion | 188 ++++++++++++++++++
> .../completion/bash/bitbake_prserv_completion |  76 +++++++
> .../bash/bitbake_selftest_completion          |  34 ++++
> 6 files changed, 581 insertions(+)
> create mode 100644 contrib/completion/bash/bitbake_completion
> create mode 100644 contrib/completion/bash/bitbake_diffsigs_completion
> create mode 100644 contrib/completion/bash/bitbake_dumpsig_completion
> create mode 100644 contrib/completion/bash/bitbake_layers_completion
> create mode 100644 contrib/completion/bash/bitbake_prserv_completion
> create mode 100644 contrib/completion/bash/bitbake_selftest_completion
>
> diff --git a/contrib/completion/bash/bitbake_completion
> b/contrib/completion/bash/bitbake_completion
> new file mode 100644
> index 00000000..23cadf6e
> --- /dev/null
> +++ b/contrib/completion/bash/bitbake_completion
> @@ -0,0 +1,108 @@
> +#!bash
> +# Bash completion support for bitbake 1.39.1 release.
> +#
> +# Copyright (C) 2014 Sergio Prado <sergio.prado@e-labworks.com>
> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
> +#
> +# Distributed under the MIT License (MIT)
> +#
> +
> +_bitbake()
> +{
> +    local cur prev opts_short opts_long tasks recipes ui
> +    local bb_layers_conf bb_layers_md5 bb_recipes
> +
> +    COMPREPLY=()
> +
> +    cur="${COMP_WORDS[COMP_CWORD]}"
> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
> +
> +    opts_short="-h -b -k -f -c -C -r -R -v -D -q -n -S -p -s -e -g -I \
> +                -l -P -u -B -T -m -w"
> +
> +    opts_long="--version --help --buildfile= --continue --force --cmd= \
> +               --clear-stamp= --read= --postread= --verbose --debug --quiet
> \
> +               --dry-run --dump-signatures= --parse-only --show-versions \
> +               --environment --graphviz --ignore-deps= --log-domains=
> --profile \
> +               --ui= --token= --revisions-changed --server-only --bind= \
> +               --idle-timeout= --no-setscene --setscene-only
> --remote-server= \
> +               --kill-server --observe-only --status-only --write-log=
> --runall= \
> +               --runonly="
> +
> +    tasks="build compile compile_ptest_base configure configure_ptest_base
> deploy \
> +           distrodata fetch image image_complete install install_ptest_base
> package \
> +           package_qa package_write_deb package_write_ipk package_write_rpm
> package_write_tar \
> +           packagedata patch populate_lic populate_sdk populate_sysroot
> prepare_recipe_sysroot \
> +           rm_work rm_work_all unpack checkpkg checkuri clean cleanall
> cleansstate devpyshell \
> +           devshell listtasks package_index bootimg bundle_initramfs rootfs
> testimage \
> +           testimage_auto compile_kernelmodules diffconfig kernel_checkout
> kernel_configcheck \
> +           kernel_configme kernel_menuconfig kernel_metadata menuconfig
> savedefconfig shared_workdir \
> +           sizecheck strip validate_branches spdx"
> +
> +    ui="knotty ncurses taskexp"
> +
> +    if [[ "$prev" == "=" ]]; then
> +        prev="${COMP_WORDS[COMP_CWORD - 2]}"
> +    elif [[ "$cur" == "=" ]]; then
> +        cur=""
> +    fi
> +
> +    conf_files=$(find . -maxdepth 1 -name "*.conf" -type f -printf '%P\n')
> +
> +    case "$prev" in
> +
> "-c"|"--cmd"|"-C"|"--clear-stamp"|"--ignore-deps"|"--runall"|"--runonly")
> +            COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-r"|"--read"|"-R"|"--postread")
> +            COMPREPLY=( $(compgen -W "${conf_files}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-u"|"--ui")
> +            COMPREPLY=( $(compgen -W "${ui}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    case "$cur" in
> +        "--"*)
> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
> +            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;
> then
> +                compopt -o nospace
> +            fi
> +            return 0
> +        ;;
> +        "-"*)
> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    bb_layers_conf="conf/bblayers.conf"
> +    bb_layers_md5=".bb_layers_conf.md5"
> +    bb_recipes=".bb_recipes"
> +
> +    _parse_recipes () {
> +        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |
> awk '{print $1}' > $bb_recipes
> +    }
> +
> +    if [ ! -e $bb_layers_conf ]; then
> +        return 0
> +    fi
> +
> +    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
> +        _parse_recipes
> +    fi
> +
> +    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
> +    if [ $? != 0 -o ! -e $bb_recipes ]; then
> +         md5sum $bb_layers_conf > $bb_layers_md5
> +         _parse_recipes
> +    fi
> +
> +    recipes=$(cat $bb_recipes)
> +
> +    COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
> +    return 0
> +}
> +complete -F _bitbake bitbake
> \ No newline at end of file
> diff --git a/contrib/completion/bash/bitbake_diffsigs_completion
> b/contrib/completion/bash/bitbake_diffsigs_completion
> new file mode 100644
> index 00000000..cbf2c5f1
> --- /dev/null
> +++ b/contrib/completion/bash/bitbake_diffsigs_completion
> @@ -0,0 +1,86 @@
> +#!bash
> +# Bash completion support for bitbake-diffsigs tool,
> +# compatible with Bitbake 1.39.1.
> +#
> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
> +#
> +# Distributed under the MIT License (MIT)
> +#
> +
> +_bitbake_diffsigs()
> +{
> +    local cur prev opts_short opts_long tasks colors
> +    local bb_layers_conf bb_layers_md5 bb_recipes
> +
> +    COMPREPLY=()
> +
> +    cur="${COMP_WORDS[COMP_CWORD]}"
> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
> +
> +    opts_short="-h -d -t -s"
> +
> +    opts_long="--help --debug --color --task --signature"
> +
> +    tasks="build compile compile_ptest_base configure configure_ptest_base
> deploy \
> +           distrodata fetch image image_complete install install_ptest_base
> package \
> +           package_qa package_write_deb package_write_ipk package_write_rpm
> package_write_tar \
> +           packagedata patch populate_lic populate_sdk populate_sysroot
> prepare_recipe_sysroot \
> +           rm_work rm_work_all unpack checkpkg checkuri clean cleanall
> cleansstate devpyshell \
> +           devshell listtasks package_index bootimg bundle_initramfs rootfs
> testimage \
> +           testimage_auto compile_kernelmodules diffconfig kernel_checkout
> kernel_configcheck \
> +           kernel_configme kernel_menuconfig kernel_metadata menuconfig
> savedefconfig shared_workdir \
> +           sizecheck strip validate_branches spdx"
> +
> +    colors="auto always never"
> +
> +    case "$cur" in
> +        "--"*)
> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-"*)
> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    bb_layers_conf="conf/bblayers.conf"
> +    bb_layers_md5=".bb_layers_conf.md5"
> +    bb_recipes=".bb_recipes"
> +
> +    _parse_recipes () {
> +        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |
> awk '{print $1}' > $bb_recipes
> +    }
> +
> +    if [ ! -e $bb_layers_conf ]; then
> +        return 0
> +    fi
> +
> +    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
> +           _parse_recipes
> +    fi
> +
> +    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
> +    if [ $? != 0 -o ! -e $bb_recipes ]; then
> +        md5sum $bb_layers_conf > $bb_layers_md5
> +        _parse_recipes
> +    fi
> +
> +    recipes=$(cat $bb_recipes)
> +
> +    case "$prev" in
> +        "-c"|"--color")
> +            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-t"|"--task")
> +          COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
> +          return 0
> +    esac
> +
> +    if [[ ${COMP_WORDS[COMP_CWORD -2]} == "-t" ]] || [[
> ${COMP_WORDS[COMP_CWORD -2]} == "--task" ]]; then
> +        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
> +           return 0
> +    fi
> +}
> +complete -F _bitbake_diffsigs bitbake-diffsigs
> \ No newline at end of file
> diff --git a/contrib/completion/bash/bitbake_dumpsig_completion
> b/contrib/completion/bash/bitbake_dumpsig_completion
> new file mode 100644
> index 00000000..95eb2394
> --- /dev/null
> +++ b/contrib/completion/bash/bitbake_dumpsig_completion
> @@ -0,0 +1,89 @@
> +#!bash
> +# Bash completion support for bitbake-dumpsig tool,
> +# compatible with Bitbake 1.39.1.
> +#
> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
> +#
> +# Distributed under the MIT License (MIT)
> +#
> +
> +_bitbake_dumpsig()
> +{
> +    local cur prev opts_short opts_long tasks
> +    local bb_layers_conf bb_layers_md5 bb_recipes
> +
> +    COMPREPLY=()
> +
> +    cur="${COMP_WORDS[COMP_CWORD]}"
> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
> +
> +    opts_short="-h -d -t"
> +
> +    opts_long="--help --debug --task="
> +
> +    tasks="build compile compile_ptest_base configure configure_ptest_base
> deploy \
> +           distrodata fetch image image_complete install install_ptest_base
> package \
> +           package_qa package_write_deb package_write_ipk package_write_rpm
> package_write_tar \
> +           packagedata patch populate_lic populate_sdk populate_sysroot
> prepare_recipe_sysroot \
> +           rm_work rm_work_all unpack checkpkg checkuri clean cleanall
> cleansstate devpyshell \
> +           devshell listtasks package_index bootimg bundle_initramfs rootfs
> testimage \
> +           testimage_auto compile_kernelmodules diffconfig kernel_checkout
> kernel_configcheck \
> +           kernel_configme kernel_menuconfig kernel_metadata menuconfig
> savedefconfig shared_workdir \
> +           sizecheck strip validate_branches spdx"
> +
> +    if [[ "$prev" == "=" ]]; then
> +        prev="${COMP_WORDS[COMP_CWORD - 2]}"
> +    elif [[ "$cur" == "=" ]]; then
> +        cur=""
> +    fi
> +
> +    case "$cur" in
> +        "--"*)
> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
> +            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;
> then
> +                compopt -o nospace
> +            fi
> +            return 0
> +        ;;
> +        "-"*)
> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    bb_layers_conf="conf/bblayers.conf"
> +    bb_layers_md5=".bb_layers_conf.md5"
> +    bb_recipes=".bb_recipes"
> +
> +    _parse_recipes () {
> +        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |
> awk '{print $1}' > $bb_recipes
> +    }
> +
> +    if [ ! -e $bb_layers_conf ]; then
> +        return 0
> +    fi
> +
> +    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
> +           _parse_recipes
> +    fi
> +
> +    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
> +    if [ $? != 0 -o ! -e $bb_recipes ]; then
> +        md5sum $bb_layers_conf > $bb_layers_md5
> +        _parse_recipes
> +    fi
> +
> +    recipes=$(cat $bb_recipes)
> +
> +    case "$prev" in
> +        "-t"|"--task")
> +           COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
> +           return 0
> +    esac
> +
> +    if [[ ${COMP_WORDS[COMP_CWORD -2]} =~ "-t" ]] || [[
> ${COMP_WORDS[COMP_CWORD -3]} == "--task" ]]; then
> +        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
> +           return 0
> +    fi
> +}
> +complete -F _bitbake_dumpsig bitbake-dumpsig
> \ No newline at end of file
> diff --git a/contrib/completion/bash/bitbake_layers_completion
> b/contrib/completion/bash/bitbake_layers_completion
> new file mode 100644
> index 00000000..37ca8afb
> --- /dev/null
> +++ b/contrib/completion/bash/bitbake_layers_completion
> @@ -0,0 +1,188 @@
> +#!bash
> +# Bash completion support for bitbake-layers tool,
> +# compatible with Bitbake 1.39.1.
> +#
> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
> +#
> +# Distributed under the MIT License (MIT)
> +#
> +
> +_bitbake_layers()
> +{
> +    local cur prev opts_short opts_long subcommands colors
> +    local opts_long_add_layer opts_short_add_layer opts_long_show_overlayed
> +    local opts_short_show_overlayed opts_long_show_recipes
> opts_short_show_recipes
> +    local opts_long_show_cross_depends opts_short_show_cross_depends
> +    local opts_long_show_layerindex_fetch opts_short_show_layerindex_fetch
> +    local opts_long_show_layerindex_show_depends
> opts_short_show_layerindex_show_depends
> +    local opts_long_show_create_layer opts_short_show_create_layer
> bb_class_files classes
> +
> +    COMPREPLY=()
> +
> +    cur="${COMP_WORDS[COMP_CWORD]}"
> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
> +
> +    opts_short="-d -q -F -h"
> +
> +    opts_long="--debug --quiet --force --color --help"
> +
> +    subcommands="layerindex-fetch layerindex-show-depends add-layer \
> +                    remove-layer flatten show-layers show-overlayed \
> +                        show-recipes show-appends show-cross-depends \
> +                        create-layer"
> +
> +    colors="auto always never"
> +
> +    opts_long_show_overlayed="--help --filenames --same-version"
> +    opts_short_show_overlayed="-h -f -s"
> +
> +    opts_long_show_recipes="--help --filenames --multiple --inherits"
> +    opts_short_show_recipes="-h -f -m -i"
> +
> +    opts_long_show_layerindex_fetch="--help --show-only --branch --ignore"
> +    opts_short_show_layerindex_fetch="-h -n -b -i"
> +
> +    opts_long_add_layer="--help --priority --example-recipe-name
> --example-recipe-version"
> +    opts_short_add_layer="-h"
> +
> +    opts_long_show_cross_depends="--help --filenames --ignore"
> +    opts_short_show_cross_depends="-h -f -i"
> +
> +    opts_long_show_layerindex_show_depends="--help --branch"
> +    opts_short_show_layerindex_show_depends="-h -b"
> +
> +    opts_long_show_create_layer="--help --priority --example-recipe-name
> --example-recipe-version"
> +    opts_short_show_create_layer="-h -p -e -v"
> +
> +    bb_class_files=".bb_class_files"
> +
> +    _get_classes() {
> +        find $BBPATH/../meta*/classes/ -name *.bbclass -exec basename {} \;
> | sed 's/.bbclass//' > $bb_class_files
> +    }
> +
> +    if [[ "${COMP_WORDS[@]}" =~ show-recipes ]] ; then
> +        if [[ "$prev" == "--inherits" ]] || [[ "$prev" == "-i" ]]; then
> +            _get_classes
> +            classes=$(cat $bb_class_files)
> +            COMPREPLY=( $(compgen -W "${classes}" -- ${cur}) )
> +            return 0
> +        fi
> +    fi
> +
> +    if [[ "${COMP_WORDS[1]}" =~
> show-layers|show-appends|remove-layer|flatten ]]; then
> +        case "$cur" in
> +            "--"*)
> +                COMPREPLY=( $(compgen -W "--help" -- ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "-h" -- ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "add-layer" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W "${opts_long_add_layer}" --
> ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "${opts_short_add_layer}" --
> ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "show-overlayed" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W "${opts_long_show_overlayed}" --
> ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "${opts_short_show_overlayed}" --
> ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "show-recipes" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W "${opts_long_show_recipes}" --
> ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "${opts_short_show_recipes}" --
> ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "show-cross-depends" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W "${opts_long_show_cross_depends}"
> -- ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "${opts_short_show_cross_depends}"
> -- ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "layerindex-fetch" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W
> "${opts_long_show_layerindex_fetch}" -- ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W
> "${opts_short_show_layerindex_fetch}" -- ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "layerindex-show-depends" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W
> "${opts_long_show_layerindex_show_depends}" -- ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W
> "${opts_short_show_layerindex_show_depends}" -- ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    elif [[ "${COMP_WORDS[1]}" == "create-layer" ]]; then
> +        case "$cur" in
> +            "--"*|"")
> +                COMPREPLY=( $(compgen -W "${opts_long_show_create_layer}"
> -- ${cur}) )
> +                return 0
> +            ;;
> +            "-"*)
> +                COMPREPLY=( $(compgen -W "${opts_short_show_create_layer}"
> -- ${cur}) )
> +                return 0
> +            ;;
> +        esac
> +    fi
> +
> +    case "$prev" in
> +        "-c"|"--color")
> +            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    case "$cur" in
> +        "--"*)
> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-"*)
> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    if [[ ${prev} == "bitbake-layers" ]]; then
> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
> +        return 0
> +    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
> +        return 0
> +    fi
> +}
> +complete -F _bitbake_layers bitbake-layers
> \ No newline at end of file
> diff --git a/contrib/completion/bash/bitbake_prserv_completion
> b/contrib/completion/bash/bitbake_prserv_completion
> new file mode 100644
> index 00000000..3bca1197
> --- /dev/null
> +++ b/contrib/completion/bash/bitbake_prserv_completion
> @@ -0,0 +1,76 @@
> +#!bash
> +# Bash completion support for bitbake-prserv tool,
> +# compatible with Bitbake 1.39.1.
> +#
> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
> +#
> +# Distributed under the MIT License (MIT)
> +#
> +
> +_bitbake_prserv()
> +{
> +    local cur prev opts_short opts_long subcommands file_default
> log_default log_levels
> +
> +    COMPREPLY=()
> +
> +    cur="${COMP_WORDS[COMP_CWORD]}"
> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
> +
> +    opts_short="-h -f -l"
> +
> +    opts_long="--version --help --file= --log= --loglevel= --start \
> +                  --stop --host= --port="
> +
> +    subcommands="layerindex-fetch layerindex-show-depends add-layer \
> +                    remove-layer flatten show-layers show-overlayed \
> +                        show-recipes show-appends show-cross-depends \
> +                        create-layer"
> +
> +    file_default="prserv.sqlite3"
> +    log_default="prserv.log"
> +    log_levels="CRITICAL ERROR WARNING INFO DEBUG"
> +
> +    if [[ "$prev" == "=" ]]; then
> +        prev="${COMP_WORDS[COMP_CWORD -2]}"
> +    elif [[ "$cur" == "=" ]]; then
> +        cur=""
> +    fi
> +
> +    case "$prev" in
> +        "-f"|"--file")
> +            COMPREPLY=( $(compgen -W "${file_default}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-l"|"--log")
> +            COMPREPLY=( $(compgen -W "${log_default}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "--loglevel")
> +            COMPREPLY=( $(compgen -W "${log_levels}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    case "$cur" in
> +        "--"*|"")
> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
> +            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;
> then
> +                compopt -o nospace
> +            fi
> +            return 0
> +        ;;
> +        "-"*)
> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +
> +    if [[ ${prev} == "bitbake-layers" ]]; then
> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
> +        return 0
> +    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
> +        return 0
> +    fi
> +}
> +complete -F _bitbake_prserv bitbake-prserv
> \ No newline at end of file
> diff --git a/contrib/completion/bash/bitbake_selftest_completion
> b/contrib/completion/bash/bitbake_selftest_completion
> new file mode 100644
> index 00000000..8b6bf641
> --- /dev/null
> +++ b/contrib/completion/bash/bitbake_selftest_completion
> @@ -0,0 +1,34 @@
> +#!bash
> +# Bash completion support for bitbake-selftest tool,
> +# compatible with Bitbake version 1.39.1.
> +#
> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
> +#
> +# Distributed under the MIT License (MIT)
> +#
> +
> +_bitbake_selftest()
> +{
> +    local cur prev opts_short opts_long
> +
> +    COMPREPLY=()
> +
> +    cur="${COMP_WORDS[COMP_CWORD]}"
> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
> +
> +    opts_short="-h -v -q -f -c"
> +
> +    opts_long="--help --verbose --quiet --locals --failfast --catch"
> +
> +    case "$cur" in
> +        "--"*)
> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
> +            return 0
> +        ;;
> +        "-"*)
> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
> +            return 0
> +        ;;
> +    esac
> +}
> +complete -F _bitbake_selftest bitbake-selftest
> \ No newline at end of file
> --
> 2.18.0
>
> --
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Add files supporting bash completion for bitbake tools
       [not found]       ` <1577859A-5F16-4E3F-8C23-1ECB099AB770@gmail.com>
@ 2018-09-03 19:25         ` Łukasz Gardoń
  2018-09-05 17:24           ` Łukasz Gardoń
  0 siblings, 1 reply; 7+ messages in thread
From: Łukasz Gardoń @ 2018-09-03 19:25 UTC (permalink / raw)
  To: Alexander Kanavin, bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 27630 bytes --]

Add missed bitbake-devel@lists.openembedded.org <mailto:bitbake-devel@lists.openembedded.org> mailing group to this thread.

> Wiadomość napisana przez Łukasz Gardoń <lukaszgardon555@gmail.com> w dniu 03.09.2018, o godz. 21:22:
> 
> Hi Alex,
> 
> thank’s for Your suggestion but for in my opinion keeping this files in bitbake repository is the better place.
> I would not know to find/search such completion files in bash-completion or any other place.
> What about vim plugin which is stored in contrib/ dir[1] and which is also comes from dedicated repo[2] same thing.
> 
> Anyway, could someone from project architects could comment and help here ?
> 
> [1] vim bitbake plugin in bitbake: https://github.com/openembedded/bitbake/tree/master/contrib/vim <https://github.com/openembedded/bitbake/tree/master/contrib/vim>
> [2] vim bitbake plugin repo: https://github.com/kergoth/vim-bitbake <https://github.com/kergoth/vim-bitbake>
> 
>> Wiadomość napisana przez Alexander Kanavin <alex.kanavin@gmail.com <mailto:alex.kanavin@gmail.com>> w dniu 03.09.2018, o godz. 11:25:
>> 
>> Hello Lukasz,
>> 
>> nobody will find your contributions in bitbake/contrib, and so they
>> will be unused and will bitrot. The proper place is the upstream
>> bash-completion project, which will get picked up by all Linux
>> distributions.
>> 
>> Alex
>> 
>> 2018-09-02 12:27 GMT+02:00 Łukasz Gardoń <lukaszgardon555@gmail.com <mailto:lukaszgardon555@gmail.com>>:
>>> Hi Alex,
>>> 
>>> With information comes file from bitbake repository -
>>> bitbake/contrib/README: "This directory is for additional contributed files
>>> which may be useful.”.
>>> I think that this is proper place for such files.
>>> 
>>> Wiadomość napisana przez Alexander Kanavin <alex.kanavin@gmail.com <mailto:alex.kanavin@gmail.com>> w dniu
>>> 01.09.2018, o godz. 21:33:
>>> 
>>> The right upstream destination for this is almost certainly
>>> https://github.com/scop/bash-completion <https://github.com/scop/bash-completion>
>>> 
>>> Alex
>>> 
>>> 2018-09-01 15:36 GMT+02:00 Łukasz Gardoń <lukaszgardon555@gmail.com>:
>>> 
>>> Repository with more details:
>>> https://github.com/lukaszgard/bitbake-completion
>>> 
>>> Signed-off-by: Łukasz Gardoń <lukaszgardon555@gmail.com>
>>> ---
>>> contrib/completion/bash/bitbake_completion    | 108 ++++++++++
>>> .../bash/bitbake_diffsigs_completion          |  86 ++++++++
>>> .../bash/bitbake_dumpsig_completion           |  89 +++++++++
>>> .../completion/bash/bitbake_layers_completion | 188 ++++++++++++++++++
>>> .../completion/bash/bitbake_prserv_completion |  76 +++++++
>>> .../bash/bitbake_selftest_completion          |  34 ++++
>>> 6 files changed, 581 insertions(+)
>>> create mode 100644 contrib/completion/bash/bitbake_completion
>>> create mode 100644 contrib/completion/bash/bitbake_diffsigs_completion
>>> create mode 100644 contrib/completion/bash/bitbake_dumpsig_completion
>>> create mode 100644 contrib/completion/bash/bitbake_layers_completion
>>> create mode 100644 contrib/completion/bash/bitbake_prserv_completion
>>> create mode 100644 contrib/completion/bash/bitbake_selftest_completion
>>> 
>>> diff --git a/contrib/completion/bash/bitbake_completion
>>> b/contrib/completion/bash/bitbake_completion
>>> new file mode 100644
>>> index 00000000..23cadf6e
>>> --- /dev/null
>>> +++ b/contrib/completion/bash/bitbake_completion
>>> @@ -0,0 +1,108 @@
>>> +#!bash
>>> +# Bash completion support for bitbake 1.39.1 release.
>>> +#
>>> +# Copyright (C) 2014 Sergio Prado <sergio.prado@e-labworks.com>
>>> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
>>> +#
>>> +# Distributed under the MIT License (MIT)
>>> +#
>>> +
>>> +_bitbake()
>>> +{
>>> +    local cur prev opts_short opts_long tasks recipes ui
>>> +    local bb_layers_conf bb_layers_md5 bb_recipes
>>> +
>>> +    COMPREPLY=()
>>> +
>>> +    cur="${COMP_WORDS[COMP_CWORD]}"
>>> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
>>> +
>>> +    opts_short="-h -b -k -f -c -C -r -R -v -D -q -n -S -p -s -e -g -I \
>>> +                -l -P -u -B -T -m -w"
>>> +
>>> +    opts_long="--version --help --buildfile= --continue --force --cmd= \
>>> +               --clear-stamp= --read= --postread= --verbose --debug --quiet
>>> \
>>> +               --dry-run --dump-signatures= --parse-only --show-versions \
>>> +               --environment --graphviz --ignore-deps= --log-domains=
>>> --profile \
>>> +               --ui= --token= --revisions-changed --server-only --bind= \
>>> +               --idle-timeout= --no-setscene --setscene-only
>>> --remote-server= \
>>> +               --kill-server --observe-only --status-only --write-log=
>>> --runall= \
>>> +               --runonly="
>>> +
>>> +    tasks="build compile compile_ptest_base configure configure_ptest_base
>>> deploy \
>>> +           distrodata fetch image image_complete install install_ptest_base
>>> package \
>>> +           package_qa package_write_deb package_write_ipk package_write_rpm
>>> package_write_tar \
>>> +           packagedata patch populate_lic populate_sdk populate_sysroot
>>> prepare_recipe_sysroot \
>>> +           rm_work rm_work_all unpack checkpkg checkuri clean cleanall
>>> cleansstate devpyshell \
>>> +           devshell listtasks package_index bootimg bundle_initramfs rootfs
>>> testimage \
>>> +           testimage_auto compile_kernelmodules diffconfig kernel_checkout
>>> kernel_configcheck \
>>> +           kernel_configme kernel_menuconfig kernel_metadata menuconfig
>>> savedefconfig shared_workdir \
>>> +           sizecheck strip validate_branches spdx"
>>> +
>>> +    ui="knotty ncurses taskexp"
>>> +
>>> +    if [[ "$prev" == "=" ]]; then
>>> +        prev="${COMP_WORDS[COMP_CWORD - 2]}"
>>> +    elif [[ "$cur" == "=" ]]; then
>>> +        cur=""
>>> +    fi
>>> +
>>> +    conf_files=$(find . -maxdepth 1 -name "*.conf" -type f -printf '%P\n')
>>> +
>>> +    case "$prev" in
>>> +
>>> "-c"|"--cmd"|"-C"|"--clear-stamp"|"--ignore-deps"|"--runall"|"--runonly")
>>> +            COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +        "-r"|"--read"|"-R"|"--postread")
>>> +            COMPREPLY=( $(compgen -W "${conf_files}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +        "-u"|"--ui")
>>> +            COMPREPLY=( $(compgen -W "${ui}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +    esac
>>> +
>>> +    case "$cur" in
>>> +        "--"*)
>>> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
>>> +            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;
>>> then
>>> +                compopt -o nospace
>>> +            fi
>>> +            return 0
>>> +        ;;
>>> +        "-"*)
>>> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +    esac
>>> +
>>> +    bb_layers_conf="conf/bblayers.conf"
>>> +    bb_layers_md5=".bb_layers_conf.md5"
>>> +    bb_recipes=".bb_recipes"
>>> +
>>> +    _parse_recipes () {
>>> +        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |
>>> awk '{print $1}' > $bb_recipes
>>> +    }
>>> +
>>> +    if [ ! -e $bb_layers_conf ]; then
>>> +        return 0
>>> +    fi
>>> +
>>> +    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
>>> +        _parse_recipes
>>> +    fi
>>> +
>>> +    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
>>> +    if [ $? != 0 -o ! -e $bb_recipes ]; then
>>> +         md5sum $bb_layers_conf > $bb_layers_md5
>>> +         _parse_recipes
>>> +    fi
>>> +
>>> +    recipes=$(cat $bb_recipes)
>>> +
>>> +    COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
>>> +    return 0
>>> +}
>>> +complete -F _bitbake bitbake
>>> \ No newline at end of file
>>> diff --git a/contrib/completion/bash/bitbake_diffsigs_completion
>>> b/contrib/completion/bash/bitbake_diffsigs_completion
>>> new file mode 100644
>>> index 00000000..cbf2c5f1
>>> --- /dev/null
>>> +++ b/contrib/completion/bash/bitbake_diffsigs_completion
>>> @@ -0,0 +1,86 @@
>>> +#!bash
>>> +# Bash completion support for bitbake-diffsigs tool,
>>> +# compatible with Bitbake 1.39.1.
>>> +#
>>> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
>>> +#
>>> +# Distributed under the MIT License (MIT)
>>> +#
>>> +
>>> +_bitbake_diffsigs()
>>> +{
>>> +    local cur prev opts_short opts_long tasks colors
>>> +    local bb_layers_conf bb_layers_md5 bb_recipes
>>> +
>>> +    COMPREPLY=()
>>> +
>>> +    cur="${COMP_WORDS[COMP_CWORD]}"
>>> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
>>> +
>>> +    opts_short="-h -d -t -s"
>>> +
>>> +    opts_long="--help --debug --color --task --signature"
>>> +
>>> +    tasks="build compile compile_ptest_base configure configure_ptest_base
>>> deploy \
>>> +           distrodata fetch image image_complete install install_ptest_base
>>> package \
>>> +           package_qa package_write_deb package_write_ipk package_write_rpm
>>> package_write_tar \
>>> +           packagedata patch populate_lic populate_sdk populate_sysroot
>>> prepare_recipe_sysroot \
>>> +           rm_work rm_work_all unpack checkpkg checkuri clean cleanall
>>> cleansstate devpyshell \
>>> +           devshell listtasks package_index bootimg bundle_initramfs rootfs
>>> testimage \
>>> +           testimage_auto compile_kernelmodules diffconfig kernel_checkout
>>> kernel_configcheck \
>>> +           kernel_configme kernel_menuconfig kernel_metadata menuconfig
>>> savedefconfig shared_workdir \
>>> +           sizecheck strip validate_branches spdx"
>>> +
>>> +    colors="auto always never"
>>> +
>>> +    case "$cur" in
>>> +        "--"*)
>>> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +        "-"*)
>>> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +    esac
>>> +
>>> +    bb_layers_conf="conf/bblayers.conf"
>>> +    bb_layers_md5=".bb_layers_conf.md5"
>>> +    bb_recipes=".bb_recipes"
>>> +
>>> +    _parse_recipes () {
>>> +        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |
>>> awk '{print $1}' > $bb_recipes
>>> +    }
>>> +
>>> +    if [ ! -e $bb_layers_conf ]; then
>>> +        return 0
>>> +    fi
>>> +
>>> +    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
>>> +           _parse_recipes
>>> +    fi
>>> +
>>> +    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
>>> +    if [ $? != 0 -o ! -e $bb_recipes ]; then
>>> +        md5sum $bb_layers_conf > $bb_layers_md5
>>> +        _parse_recipes
>>> +    fi
>>> +
>>> +    recipes=$(cat $bb_recipes)
>>> +
>>> +    case "$prev" in
>>> +        "-c"|"--color")
>>> +            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +        "-t"|"--task")
>>> +          COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
>>> +          return 0
>>> +    esac
>>> +
>>> +    if [[ ${COMP_WORDS[COMP_CWORD -2]} == "-t" ]] || [[
>>> ${COMP_WORDS[COMP_CWORD -2]} == "--task" ]]; then
>>> +        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
>>> +           return 0
>>> +    fi
>>> +}
>>> +complete -F _bitbake_diffsigs bitbake-diffsigs
>>> \ No newline at end of file
>>> diff --git a/contrib/completion/bash/bitbake_dumpsig_completion
>>> b/contrib/completion/bash/bitbake_dumpsig_completion
>>> new file mode 100644
>>> index 00000000..95eb2394
>>> --- /dev/null
>>> +++ b/contrib/completion/bash/bitbake_dumpsig_completion
>>> @@ -0,0 +1,89 @@
>>> +#!bash
>>> +# Bash completion support for bitbake-dumpsig tool,
>>> +# compatible with Bitbake 1.39.1.
>>> +#
>>> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
>>> +#
>>> +# Distributed under the MIT License (MIT)
>>> +#
>>> +
>>> +_bitbake_dumpsig()
>>> +{
>>> +    local cur prev opts_short opts_long tasks
>>> +    local bb_layers_conf bb_layers_md5 bb_recipes
>>> +
>>> +    COMPREPLY=()
>>> +
>>> +    cur="${COMP_WORDS[COMP_CWORD]}"
>>> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
>>> +
>>> +    opts_short="-h -d -t"
>>> +
>>> +    opts_long="--help --debug --task="
>>> +
>>> +    tasks="build compile compile_ptest_base configure configure_ptest_base
>>> deploy \
>>> +           distrodata fetch image image_complete install install_ptest_base
>>> package \
>>> +           package_qa package_write_deb package_write_ipk package_write_rpm
>>> package_write_tar \
>>> +           packagedata patch populate_lic populate_sdk populate_sysroot
>>> prepare_recipe_sysroot \
>>> +           rm_work rm_work_all unpack checkpkg checkuri clean cleanall
>>> cleansstate devpyshell \
>>> +           devshell listtasks package_index bootimg bundle_initramfs rootfs
>>> testimage \
>>> +           testimage_auto compile_kernelmodules diffconfig kernel_checkout
>>> kernel_configcheck \
>>> +           kernel_configme kernel_menuconfig kernel_metadata menuconfig
>>> savedefconfig shared_workdir \
>>> +           sizecheck strip validate_branches spdx"
>>> +
>>> +    if [[ "$prev" == "=" ]]; then
>>> +        prev="${COMP_WORDS[COMP_CWORD - 2]}"
>>> +    elif [[ "$cur" == "=" ]]; then
>>> +        cur=""
>>> +    fi
>>> +
>>> +    case "$cur" in
>>> +        "--"*)
>>> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
>>> +            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;
>>> then
>>> +                compopt -o nospace
>>> +            fi
>>> +            return 0
>>> +        ;;
>>> +        "-"*)
>>> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +    esac
>>> +
>>> +    bb_layers_conf="conf/bblayers.conf"
>>> +    bb_layers_md5=".bb_layers_conf.md5"
>>> +    bb_recipes=".bb_recipes"
>>> +
>>> +    _parse_recipes () {
>>> +        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |
>>> awk '{print $1}' > $bb_recipes
>>> +    }
>>> +
>>> +    if [ ! -e $bb_layers_conf ]; then
>>> +        return 0
>>> +    fi
>>> +
>>> +    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
>>> +           _parse_recipes
>>> +    fi
>>> +
>>> +    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
>>> +    if [ $? != 0 -o ! -e $bb_recipes ]; then
>>> +        md5sum $bb_layers_conf > $bb_layers_md5
>>> +        _parse_recipes
>>> +    fi
>>> +
>>> +    recipes=$(cat $bb_recipes)
>>> +
>>> +    case "$prev" in
>>> +        "-t"|"--task")
>>> +           COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
>>> +           return 0
>>> +    esac
>>> +
>>> +    if [[ ${COMP_WORDS[COMP_CWORD -2]} =~ "-t" ]] || [[
>>> ${COMP_WORDS[COMP_CWORD -3]} == "--task" ]]; then
>>> +        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
>>> +           return 0
>>> +    fi
>>> +}
>>> +complete -F _bitbake_dumpsig bitbake-dumpsig
>>> \ No newline at end of file
>>> diff --git a/contrib/completion/bash/bitbake_layers_completion
>>> b/contrib/completion/bash/bitbake_layers_completion
>>> new file mode 100644
>>> index 00000000..37ca8afb
>>> --- /dev/null
>>> +++ b/contrib/completion/bash/bitbake_layers_completion
>>> @@ -0,0 +1,188 @@
>>> +#!bash
>>> +# Bash completion support for bitbake-layers tool,
>>> +# compatible with Bitbake 1.39.1.
>>> +#
>>> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
>>> +#
>>> +# Distributed under the MIT License (MIT)
>>> +#
>>> +
>>> +_bitbake_layers()
>>> +{
>>> +    local cur prev opts_short opts_long subcommands colors
>>> +    local opts_long_add_layer opts_short_add_layer opts_long_show_overlayed
>>> +    local opts_short_show_overlayed opts_long_show_recipes
>>> opts_short_show_recipes
>>> +    local opts_long_show_cross_depends opts_short_show_cross_depends
>>> +    local opts_long_show_layerindex_fetch opts_short_show_layerindex_fetch
>>> +    local opts_long_show_layerindex_show_depends
>>> opts_short_show_layerindex_show_depends
>>> +    local opts_long_show_create_layer opts_short_show_create_layer
>>> bb_class_files classes
>>> +
>>> +    COMPREPLY=()
>>> +
>>> +    cur="${COMP_WORDS[COMP_CWORD]}"
>>> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
>>> +
>>> +    opts_short="-d -q -F -h"
>>> +
>>> +    opts_long="--debug --quiet --force --color --help"
>>> +
>>> +    subcommands="layerindex-fetch layerindex-show-depends add-layer \
>>> +                    remove-layer flatten show-layers show-overlayed \
>>> +                        show-recipes show-appends show-cross-depends \
>>> +                        create-layer"
>>> +
>>> +    colors="auto always never"
>>> +
>>> +    opts_long_show_overlayed="--help --filenames --same-version"
>>> +    opts_short_show_overlayed="-h -f -s"
>>> +
>>> +    opts_long_show_recipes="--help --filenames --multiple --inherits"
>>> +    opts_short_show_recipes="-h -f -m -i"
>>> +
>>> +    opts_long_show_layerindex_fetch="--help --show-only --branch --ignore"
>>> +    opts_short_show_layerindex_fetch="-h -n -b -i"
>>> +
>>> +    opts_long_add_layer="--help --priority --example-recipe-name
>>> --example-recipe-version"
>>> +    opts_short_add_layer="-h"
>>> +
>>> +    opts_long_show_cross_depends="--help --filenames --ignore"
>>> +    opts_short_show_cross_depends="-h -f -i"
>>> +
>>> +    opts_long_show_layerindex_show_depends="--help --branch"
>>> +    opts_short_show_layerindex_show_depends="-h -b"
>>> +
>>> +    opts_long_show_create_layer="--help --priority --example-recipe-name
>>> --example-recipe-version"
>>> +    opts_short_show_create_layer="-h -p -e -v"
>>> +
>>> +    bb_class_files=".bb_class_files"
>>> +
>>> +    _get_classes() {
>>> +        find $BBPATH/../meta*/classes/ -name *.bbclass -exec basename {} \;
>>> | sed 's/.bbclass//' > $bb_class_files
>>> +    }
>>> +
>>> +    if [[ "${COMP_WORDS[@]}" =~ show-recipes ]] ; then
>>> +        if [[ "$prev" == "--inherits" ]] || [[ "$prev" == "-i" ]]; then
>>> +            _get_classes
>>> +            classes=$(cat $bb_class_files)
>>> +            COMPREPLY=( $(compgen -W "${classes}" -- ${cur}) )
>>> +            return 0
>>> +        fi
>>> +    fi
>>> +
>>> +    if [[ "${COMP_WORDS[1]}" =~
>>> show-layers|show-appends|remove-layer|flatten ]]; then
>>> +        case "$cur" in
>>> +            "--"*)
>>> +                COMPREPLY=( $(compgen -W "--help" -- ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +            "-"*)
>>> +                COMPREPLY=( $(compgen -W "-h" -- ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +        esac
>>> +    elif [[ "${COMP_WORDS[1]}" == "add-layer" ]]; then
>>> +        case "$cur" in
>>> +            "--"*|"")
>>> +                COMPREPLY=( $(compgen -W "${opts_long_add_layer}" --
>>> ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +            "-"*)
>>> +                COMPREPLY=( $(compgen -W "${opts_short_add_layer}" --
>>> ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +        esac
>>> +    elif [[ "${COMP_WORDS[1]}" == "show-overlayed" ]]; then
>>> +        case "$cur" in
>>> +            "--"*|"")
>>> +                COMPREPLY=( $(compgen -W "${opts_long_show_overlayed}" --
>>> ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +            "-"*)
>>> +                COMPREPLY=( $(compgen -W "${opts_short_show_overlayed}" --
>>> ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +        esac
>>> +    elif [[ "${COMP_WORDS[1]}" == "show-recipes" ]]; then
>>> +        case "$cur" in
>>> +            "--"*|"")
>>> +                COMPREPLY=( $(compgen -W "${opts_long_show_recipes}" --
>>> ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +            "-"*)
>>> +                COMPREPLY=( $(compgen -W "${opts_short_show_recipes}" --
>>> ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +        esac
>>> +    elif [[ "${COMP_WORDS[1]}" == "show-cross-depends" ]]; then
>>> +        case "$cur" in
>>> +            "--"*|"")
>>> +                COMPREPLY=( $(compgen -W "${opts_long_show_cross_depends}"
>>> -- ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +            "-"*)
>>> +                COMPREPLY=( $(compgen -W "${opts_short_show_cross_depends}"
>>> -- ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +        esac
>>> +    elif [[ "${COMP_WORDS[1]}" == "layerindex-fetch" ]]; then
>>> +        case "$cur" in
>>> +            "--"*|"")
>>> +                COMPREPLY=( $(compgen -W
>>> "${opts_long_show_layerindex_fetch}" -- ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +            "-"*)
>>> +                COMPREPLY=( $(compgen -W
>>> "${opts_short_show_layerindex_fetch}" -- ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +        esac
>>> +    elif [[ "${COMP_WORDS[1]}" == "layerindex-show-depends" ]]; then
>>> +        case "$cur" in
>>> +            "--"*|"")
>>> +                COMPREPLY=( $(compgen -W
>>> "${opts_long_show_layerindex_show_depends}" -- ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +            "-"*)
>>> +                COMPREPLY=( $(compgen -W
>>> "${opts_short_show_layerindex_show_depends}" -- ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +        esac
>>> +    elif [[ "${COMP_WORDS[1]}" == "create-layer" ]]; then
>>> +        case "$cur" in
>>> +            "--"*|"")
>>> +                COMPREPLY=( $(compgen -W "${opts_long_show_create_layer}"
>>> -- ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +            "-"*)
>>> +                COMPREPLY=( $(compgen -W "${opts_short_show_create_layer}"
>>> -- ${cur}) )
>>> +                return 0
>>> +            ;;
>>> +        esac
>>> +    fi
>>> +
>>> +    case "$prev" in
>>> +        "-c"|"--color")
>>> +            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +    esac
>>> +
>>> +    case "$cur" in
>>> +        "--"*)
>>> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +        "-"*)
>>> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +    esac
>>> +
>>> +    if [[ ${prev} == "bitbake-layers" ]]; then
>>> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
>>> +        return 0
>>> +    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
>>> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
>>> +        return 0
>>> +    fi
>>> +}
>>> +complete -F _bitbake_layers bitbake-layers
>>> \ No newline at end of file
>>> diff --git a/contrib/completion/bash/bitbake_prserv_completion
>>> b/contrib/completion/bash/bitbake_prserv_completion
>>> new file mode 100644
>>> index 00000000..3bca1197
>>> --- /dev/null
>>> +++ b/contrib/completion/bash/bitbake_prserv_completion
>>> @@ -0,0 +1,76 @@
>>> +#!bash
>>> +# Bash completion support for bitbake-prserv tool,
>>> +# compatible with Bitbake 1.39.1.
>>> +#
>>> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
>>> +#
>>> +# Distributed under the MIT License (MIT)
>>> +#
>>> +
>>> +_bitbake_prserv()
>>> +{
>>> +    local cur prev opts_short opts_long subcommands file_default
>>> log_default log_levels
>>> +
>>> +    COMPREPLY=()
>>> +
>>> +    cur="${COMP_WORDS[COMP_CWORD]}"
>>> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
>>> +
>>> +    opts_short="-h -f -l"
>>> +
>>> +    opts_long="--version --help --file= --log= --loglevel= --start \
>>> +                  --stop --host= --port="
>>> +
>>> +    subcommands="layerindex-fetch layerindex-show-depends add-layer \
>>> +                    remove-layer flatten show-layers show-overlayed \
>>> +                        show-recipes show-appends show-cross-depends \
>>> +                        create-layer"
>>> +
>>> +    file_default="prserv.sqlite3"
>>> +    log_default="prserv.log"
>>> +    log_levels="CRITICAL ERROR WARNING INFO DEBUG"
>>> +
>>> +    if [[ "$prev" == "=" ]]; then
>>> +        prev="${COMP_WORDS[COMP_CWORD -2]}"
>>> +    elif [[ "$cur" == "=" ]]; then
>>> +        cur=""
>>> +    fi
>>> +
>>> +    case "$prev" in
>>> +        "-f"|"--file")
>>> +            COMPREPLY=( $(compgen -W "${file_default}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +        "-l"|"--log")
>>> +            COMPREPLY=( $(compgen -W "${log_default}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +        "--loglevel")
>>> +            COMPREPLY=( $(compgen -W "${log_levels}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +    esac
>>> +
>>> +    case "$cur" in
>>> +        "--"*|"")
>>> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
>>> +            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;
>>> then
>>> +                compopt -o nospace
>>> +            fi
>>> +            return 0
>>> +        ;;
>>> +        "-"*)
>>> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +    esac
>>> +
>>> +    if [[ ${prev} == "bitbake-layers" ]]; then
>>> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
>>> +        return 0
>>> +    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
>>> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
>>> +        return 0
>>> +    fi
>>> +}
>>> +complete -F _bitbake_prserv bitbake-prserv
>>> \ No newline at end of file
>>> diff --git a/contrib/completion/bash/bitbake_selftest_completion
>>> b/contrib/completion/bash/bitbake_selftest_completion
>>> new file mode 100644
>>> index 00000000..8b6bf641
>>> --- /dev/null
>>> +++ b/contrib/completion/bash/bitbake_selftest_completion
>>> @@ -0,0 +1,34 @@
>>> +#!bash
>>> +# Bash completion support for bitbake-selftest tool,
>>> +# compatible with Bitbake version 1.39.1.
>>> +#
>>> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
>>> +#
>>> +# Distributed under the MIT License (MIT)
>>> +#
>>> +
>>> +_bitbake_selftest()
>>> +{
>>> +    local cur prev opts_short opts_long
>>> +
>>> +    COMPREPLY=()
>>> +
>>> +    cur="${COMP_WORDS[COMP_CWORD]}"
>>> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
>>> +
>>> +    opts_short="-h -v -q -f -c"
>>> +
>>> +    opts_long="--help --verbose --quiet --locals --failfast --catch"
>>> +
>>> +    case "$cur" in
>>> +        "--"*)
>>> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +        "-"*)
>>> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
>>> +            return 0
>>> +        ;;
>>> +    esac
>>> +}
>>> +complete -F _bitbake_selftest bitbake-selftest
>>> \ No newline at end of file
>>> --
>>> 2.18.0
>>> 
>>> --
>>> _______________________________________________
>>> bitbake-devel mailing list
>>> bitbake-devel@lists.openembedded.org
>>> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>>> 
>>> 
> 


[-- Attachment #2: Type: text/html, Size: 50187 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Add files supporting bash completion for bitbake tools
  2018-09-03 19:25         ` Łukasz Gardoń
@ 2018-09-05 17:24           ` Łukasz Gardoń
  2018-09-05 17:28             ` richard.purdie
  0 siblings, 1 reply; 7+ messages in thread
From: Łukasz Gardoń @ 2018-09-05 17:24 UTC (permalink / raw)
  To: Alexander Kanavin, bitbake-devel, richard.purdie

[-- Attachment #1: Type: text/plain, Size: 29102 bytes --]

Richard, may I ask You kindly help here to decide if such files should be stored in bitbake repository ?

And I see that I used --subject-prefix="[bitbake-devel]”  flag while uploading patch, that cause to add additional "[ ]" to topic:
[[bitbake-devel]] Add files supporting bash completion for bitbake tools
Generally I can’t see my patch in the patchwork, It means that I should try again upload this changes to be sure that will be in patchwork properly ?

> Wiadomość napisana przez Łukasz Gardoń <lukaszgardon555@gmail.com> w dniu 03.09.2018, o godz. 21:25:
> 
> Add missed bitbake-devel@lists.openembedded.org <mailto:bitbake-devel@lists.openembedded.org> mailing group to this thread.
> 
>> Wiadomość napisana przez Łukasz Gardoń <lukaszgardon555@gmail.com <mailto:lukaszgardon555@gmail.com>> w dniu 03.09.2018, o godz. 21:22:
>> 
>> Hi Alex,
>> 
>> thank’s for Your suggestion but for in my opinion keeping this files in bitbake repository is the better place.
>> I would not know to find/search such completion files in bash-completion or any other place.
>> What about vim plugin which is stored in contrib/ dir[1] and which is also comes from dedicated repo[2] same thing.
>> 
>> Anyway, could someone from project architects could comment and help here ?
>> 
>> [1] vim bitbake plugin in bitbake: https://github.com/openembedded/bitbake/tree/master/contrib/vim <https://github.com/openembedded/bitbake/tree/master/contrib/vim>
>> [2] vim bitbake plugin repo: https://github.com/kergoth/vim-bitbake <https://github.com/kergoth/vim-bitbake>
>> 
>>> Wiadomość napisana przez Alexander Kanavin <alex.kanavin@gmail.com <mailto:alex.kanavin@gmail.com>> w dniu 03.09.2018, o godz. 11:25:
>>> 
>>> Hello Lukasz,
>>> 
>>> nobody will find your contributions in bitbake/contrib, and so they
>>> will be unused and will bitrot. The proper place is the upstream
>>> bash-completion project, which will get picked up by all Linux
>>> distributions.
>>> 
>>> Alex
>>> 
>>> 2018-09-02 12:27 GMT+02:00 Łukasz Gardoń <lukaszgardon555@gmail.com <mailto:lukaszgardon555@gmail.com>>:
>>>> Hi Alex,
>>>> 
>>>> With information comes file from bitbake repository -
>>>> bitbake/contrib/README: "This directory is for additional contributed files
>>>> which may be useful.”.
>>>> I think that this is proper place for such files.
>>>> 
>>>> Wiadomość napisana przez Alexander Kanavin <alex.kanavin@gmail.com <mailto:alex.kanavin@gmail.com>> w dniu
>>>> 01.09.2018, o godz. 21:33:
>>>> 
>>>> The right upstream destination for this is almost certainly
>>>> https://github.com/scop/bash-completion <https://github.com/scop/bash-completion>
>>>> 
>>>> Alex
>>>> 
>>>> 2018-09-01 15:36 GMT+02:00 Łukasz Gardoń <lukaszgardon555@gmail.com <mailto:lukaszgardon555@gmail.com>>:
>>>> 
>>>> Repository with more details:
>>>> https://github.com/lukaszgard/bitbake-completion <https://github.com/lukaszgard/bitbake-completion>
>>>> 
>>>> Signed-off-by: Łukasz Gardoń <lukaszgardon555@gmail.com>
>>>> ---
>>>> contrib/completion/bash/bitbake_completion    | 108 ++++++++++
>>>> .../bash/bitbake_diffsigs_completion          |  86 ++++++++
>>>> .../bash/bitbake_dumpsig_completion           |  89 +++++++++
>>>> .../completion/bash/bitbake_layers_completion | 188 ++++++++++++++++++
>>>> .../completion/bash/bitbake_prserv_completion |  76 +++++++
>>>> .../bash/bitbake_selftest_completion          |  34 ++++
>>>> 6 files changed, 581 insertions(+)
>>>> create mode 100644 contrib/completion/bash/bitbake_completion
>>>> create mode 100644 contrib/completion/bash/bitbake_diffsigs_completion
>>>> create mode 100644 contrib/completion/bash/bitbake_dumpsig_completion
>>>> create mode 100644 contrib/completion/bash/bitbake_layers_completion
>>>> create mode 100644 contrib/completion/bash/bitbake_prserv_completion
>>>> create mode 100644 contrib/completion/bash/bitbake_selftest_completion
>>>> 
>>>> diff --git a/contrib/completion/bash/bitbake_completion
>>>> b/contrib/completion/bash/bitbake_completion
>>>> new file mode 100644
>>>> index 00000000..23cadf6e
>>>> --- /dev/null
>>>> +++ b/contrib/completion/bash/bitbake_completion
>>>> @@ -0,0 +1,108 @@
>>>> +#!bash
>>>> +# Bash completion support for bitbake 1.39.1 release.
>>>> +#
>>>> +# Copyright (C) 2014 Sergio Prado <sergio.prado@e-labworks.com>
>>>> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
>>>> +#
>>>> +# Distributed under the MIT License (MIT)
>>>> +#
>>>> +
>>>> +_bitbake()
>>>> +{
>>>> +    local cur prev opts_short opts_long tasks recipes ui
>>>> +    local bb_layers_conf bb_layers_md5 bb_recipes
>>>> +
>>>> +    COMPREPLY=()
>>>> +
>>>> +    cur="${COMP_WORDS[COMP_CWORD]}"
>>>> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
>>>> +
>>>> +    opts_short="-h -b -k -f -c -C -r -R -v -D -q -n -S -p -s -e -g -I \
>>>> +                -l -P -u -B -T -m -w"
>>>> +
>>>> +    opts_long="--version --help --buildfile= --continue --force --cmd= \
>>>> +               --clear-stamp= --read= --postread= --verbose --debug --quiet
>>>> \
>>>> +               --dry-run --dump-signatures= --parse-only --show-versions \
>>>> +               --environment --graphviz --ignore-deps= --log-domains=
>>>> --profile \
>>>> +               --ui= --token= --revisions-changed --server-only --bind= \
>>>> +               --idle-timeout= --no-setscene --setscene-only
>>>> --remote-server= \
>>>> +               --kill-server --observe-only --status-only --write-log=
>>>> --runall= \
>>>> +               --runonly="
>>>> +
>>>> +    tasks="build compile compile_ptest_base configure configure_ptest_base
>>>> deploy \
>>>> +           distrodata fetch image image_complete install install_ptest_base
>>>> package \
>>>> +           package_qa package_write_deb package_write_ipk package_write_rpm
>>>> package_write_tar \
>>>> +           packagedata patch populate_lic populate_sdk populate_sysroot
>>>> prepare_recipe_sysroot \
>>>> +           rm_work rm_work_all unpack checkpkg checkuri clean cleanall
>>>> cleansstate devpyshell \
>>>> +           devshell listtasks package_index bootimg bundle_initramfs rootfs
>>>> testimage \
>>>> +           testimage_auto compile_kernelmodules diffconfig kernel_checkout
>>>> kernel_configcheck \
>>>> +           kernel_configme kernel_menuconfig kernel_metadata menuconfig
>>>> savedefconfig shared_workdir \
>>>> +           sizecheck strip validate_branches spdx"
>>>> +
>>>> +    ui="knotty ncurses taskexp"
>>>> +
>>>> +    if [[ "$prev" == "=" ]]; then
>>>> +        prev="${COMP_WORDS[COMP_CWORD - 2]}"
>>>> +    elif [[ "$cur" == "=" ]]; then
>>>> +        cur=""
>>>> +    fi
>>>> +
>>>> +    conf_files=$(find . -maxdepth 1 -name "*.conf" -type f -printf '%P\n')
>>>> +
>>>> +    case "$prev" in
>>>> +
>>>> "-c"|"--cmd"|"-C"|"--clear-stamp"|"--ignore-deps"|"--runall"|"--runonly")
>>>> +            COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +        "-r"|"--read"|"-R"|"--postread")
>>>> +            COMPREPLY=( $(compgen -W "${conf_files}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +        "-u"|"--ui")
>>>> +            COMPREPLY=( $(compgen -W "${ui}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +    esac
>>>> +
>>>> +    case "$cur" in
>>>> +        "--"*)
>>>> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
>>>> +            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;
>>>> then
>>>> +                compopt -o nospace
>>>> +            fi
>>>> +            return 0
>>>> +        ;;
>>>> +        "-"*)
>>>> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +    esac
>>>> +
>>>> +    bb_layers_conf="conf/bblayers.conf"
>>>> +    bb_layers_md5=".bb_layers_conf.md5"
>>>> +    bb_recipes=".bb_recipes"
>>>> +
>>>> +    _parse_recipes () {
>>>> +        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |
>>>> awk '{print $1}' > $bb_recipes
>>>> +    }
>>>> +
>>>> +    if [ ! -e $bb_layers_conf ]; then
>>>> +        return 0
>>>> +    fi
>>>> +
>>>> +    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
>>>> +        _parse_recipes
>>>> +    fi
>>>> +
>>>> +    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
>>>> +    if [ $? != 0 -o ! -e $bb_recipes ]; then
>>>> +         md5sum $bb_layers_conf > $bb_layers_md5
>>>> +         _parse_recipes
>>>> +    fi
>>>> +
>>>> +    recipes=$(cat $bb_recipes)
>>>> +
>>>> +    COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
>>>> +    return 0
>>>> +}
>>>> +complete -F _bitbake bitbake
>>>> \ No newline at end of file
>>>> diff --git a/contrib/completion/bash/bitbake_diffsigs_completion
>>>> b/contrib/completion/bash/bitbake_diffsigs_completion
>>>> new file mode 100644
>>>> index 00000000..cbf2c5f1
>>>> --- /dev/null
>>>> +++ b/contrib/completion/bash/bitbake_diffsigs_completion
>>>> @@ -0,0 +1,86 @@
>>>> +#!bash
>>>> +# Bash completion support for bitbake-diffsigs tool,
>>>> +# compatible with Bitbake 1.39.1.
>>>> +#
>>>> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
>>>> +#
>>>> +# Distributed under the MIT License (MIT)
>>>> +#
>>>> +
>>>> +_bitbake_diffsigs()
>>>> +{
>>>> +    local cur prev opts_short opts_long tasks colors
>>>> +    local bb_layers_conf bb_layers_md5 bb_recipes
>>>> +
>>>> +    COMPREPLY=()
>>>> +
>>>> +    cur="${COMP_WORDS[COMP_CWORD]}"
>>>> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
>>>> +
>>>> +    opts_short="-h -d -t -s"
>>>> +
>>>> +    opts_long="--help --debug --color --task --signature"
>>>> +
>>>> +    tasks="build compile compile_ptest_base configure configure_ptest_base
>>>> deploy \
>>>> +           distrodata fetch image image_complete install install_ptest_base
>>>> package \
>>>> +           package_qa package_write_deb package_write_ipk package_write_rpm
>>>> package_write_tar \
>>>> +           packagedata patch populate_lic populate_sdk populate_sysroot
>>>> prepare_recipe_sysroot \
>>>> +           rm_work rm_work_all unpack checkpkg checkuri clean cleanall
>>>> cleansstate devpyshell \
>>>> +           devshell listtasks package_index bootimg bundle_initramfs rootfs
>>>> testimage \
>>>> +           testimage_auto compile_kernelmodules diffconfig kernel_checkout
>>>> kernel_configcheck \
>>>> +           kernel_configme kernel_menuconfig kernel_metadata menuconfig
>>>> savedefconfig shared_workdir \
>>>> +           sizecheck strip validate_branches spdx"
>>>> +
>>>> +    colors="auto always never"
>>>> +
>>>> +    case "$cur" in
>>>> +        "--"*)
>>>> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +        "-"*)
>>>> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +    esac
>>>> +
>>>> +    bb_layers_conf="conf/bblayers.conf"
>>>> +    bb_layers_md5=".bb_layers_conf.md5"
>>>> +    bb_recipes=".bb_recipes"
>>>> +
>>>> +    _parse_recipes () {
>>>> +        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |
>>>> awk '{print $1}' > $bb_recipes
>>>> +    }
>>>> +
>>>> +    if [ ! -e $bb_layers_conf ]; then
>>>> +        return 0
>>>> +    fi
>>>> +
>>>> +    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
>>>> +           _parse_recipes
>>>> +    fi
>>>> +
>>>> +    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
>>>> +    if [ $? != 0 -o ! -e $bb_recipes ]; then
>>>> +        md5sum $bb_layers_conf > $bb_layers_md5
>>>> +        _parse_recipes
>>>> +    fi
>>>> +
>>>> +    recipes=$(cat $bb_recipes)
>>>> +
>>>> +    case "$prev" in
>>>> +        "-c"|"--color")
>>>> +            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +        "-t"|"--task")
>>>> +          COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
>>>> +          return 0
>>>> +    esac
>>>> +
>>>> +    if [[ ${COMP_WORDS[COMP_CWORD -2]} == "-t" ]] || [[
>>>> ${COMP_WORDS[COMP_CWORD -2]} == "--task" ]]; then
>>>> +        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
>>>> +           return 0
>>>> +    fi
>>>> +}
>>>> +complete -F _bitbake_diffsigs bitbake-diffsigs
>>>> \ No newline at end of file
>>>> diff --git a/contrib/completion/bash/bitbake_dumpsig_completion
>>>> b/contrib/completion/bash/bitbake_dumpsig_completion
>>>> new file mode 100644
>>>> index 00000000..95eb2394
>>>> --- /dev/null
>>>> +++ b/contrib/completion/bash/bitbake_dumpsig_completion
>>>> @@ -0,0 +1,89 @@
>>>> +#!bash
>>>> +# Bash completion support for bitbake-dumpsig tool,
>>>> +# compatible with Bitbake 1.39.1.
>>>> +#
>>>> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
>>>> +#
>>>> +# Distributed under the MIT License (MIT)
>>>> +#
>>>> +
>>>> +_bitbake_dumpsig()
>>>> +{
>>>> +    local cur prev opts_short opts_long tasks
>>>> +    local bb_layers_conf bb_layers_md5 bb_recipes
>>>> +
>>>> +    COMPREPLY=()
>>>> +
>>>> +    cur="${COMP_WORDS[COMP_CWORD]}"
>>>> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
>>>> +
>>>> +    opts_short="-h -d -t"
>>>> +
>>>> +    opts_long="--help --debug --task="
>>>> +
>>>> +    tasks="build compile compile_ptest_base configure configure_ptest_base
>>>> deploy \
>>>> +           distrodata fetch image image_complete install install_ptest_base
>>>> package \
>>>> +           package_qa package_write_deb package_write_ipk package_write_rpm
>>>> package_write_tar \
>>>> +           packagedata patch populate_lic populate_sdk populate_sysroot
>>>> prepare_recipe_sysroot \
>>>> +           rm_work rm_work_all unpack checkpkg checkuri clean cleanall
>>>> cleansstate devpyshell \
>>>> +           devshell listtasks package_index bootimg bundle_initramfs rootfs
>>>> testimage \
>>>> +           testimage_auto compile_kernelmodules diffconfig kernel_checkout
>>>> kernel_configcheck \
>>>> +           kernel_configme kernel_menuconfig kernel_metadata menuconfig
>>>> savedefconfig shared_workdir \
>>>> +           sizecheck strip validate_branches spdx"
>>>> +
>>>> +    if [[ "$prev" == "=" ]]; then
>>>> +        prev="${COMP_WORDS[COMP_CWORD - 2]}"
>>>> +    elif [[ "$cur" == "=" ]]; then
>>>> +        cur=""
>>>> +    fi
>>>> +
>>>> +    case "$cur" in
>>>> +        "--"*)
>>>> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
>>>> +            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;
>>>> then
>>>> +                compopt -o nospace
>>>> +            fi
>>>> +            return 0
>>>> +        ;;
>>>> +        "-"*)
>>>> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +    esac
>>>> +
>>>> +    bb_layers_conf="conf/bblayers.conf"
>>>> +    bb_layers_md5=".bb_layers_conf.md5"
>>>> +    bb_recipes=".bb_recipes"
>>>> +
>>>> +    _parse_recipes () {
>>>> +        bitbake -s | sed -e '0,/^=.*/d' -e '/^\s*$/d' -e '/^Summary:/d' |
>>>> awk '{print $1}' > $bb_recipes
>>>> +    }
>>>> +
>>>> +    if [ ! -e $bb_layers_conf ]; then
>>>> +        return 0
>>>> +    fi
>>>> +
>>>> +    if [ "$prev" = "bitbake" -a "$cur" = "" ]; then
>>>> +           _parse_recipes
>>>> +    fi
>>>> +
>>>> +    md5sum --quiet --status -c $bb_layers_md5 2>/dev/null
>>>> +    if [ $? != 0 -o ! -e $bb_recipes ]; then
>>>> +        md5sum $bb_layers_conf > $bb_layers_md5
>>>> +        _parse_recipes
>>>> +    fi
>>>> +
>>>> +    recipes=$(cat $bb_recipes)
>>>> +
>>>> +    case "$prev" in
>>>> +        "-t"|"--task")
>>>> +           COMPREPLY=( $(compgen -W "${recipes}" -- ${cur}) )
>>>> +           return 0
>>>> +    esac
>>>> +
>>>> +    if [[ ${COMP_WORDS[COMP_CWORD -2]} =~ "-t" ]] || [[
>>>> ${COMP_WORDS[COMP_CWORD -3]} == "--task" ]]; then
>>>> +        COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
>>>> +           return 0
>>>> +    fi
>>>> +}
>>>> +complete -F _bitbake_dumpsig bitbake-dumpsig
>>>> \ No newline at end of file
>>>> diff --git a/contrib/completion/bash/bitbake_layers_completion
>>>> b/contrib/completion/bash/bitbake_layers_completion
>>>> new file mode 100644
>>>> index 00000000..37ca8afb
>>>> --- /dev/null
>>>> +++ b/contrib/completion/bash/bitbake_layers_completion
>>>> @@ -0,0 +1,188 @@
>>>> +#!bash
>>>> +# Bash completion support for bitbake-layers tool,
>>>> +# compatible with Bitbake 1.39.1.
>>>> +#
>>>> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
>>>> +#
>>>> +# Distributed under the MIT License (MIT)
>>>> +#
>>>> +
>>>> +_bitbake_layers()
>>>> +{
>>>> +    local cur prev opts_short opts_long subcommands colors
>>>> +    local opts_long_add_layer opts_short_add_layer opts_long_show_overlayed
>>>> +    local opts_short_show_overlayed opts_long_show_recipes
>>>> opts_short_show_recipes
>>>> +    local opts_long_show_cross_depends opts_short_show_cross_depends
>>>> +    local opts_long_show_layerindex_fetch opts_short_show_layerindex_fetch
>>>> +    local opts_long_show_layerindex_show_depends
>>>> opts_short_show_layerindex_show_depends
>>>> +    local opts_long_show_create_layer opts_short_show_create_layer
>>>> bb_class_files classes
>>>> +
>>>> +    COMPREPLY=()
>>>> +
>>>> +    cur="${COMP_WORDS[COMP_CWORD]}"
>>>> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
>>>> +
>>>> +    opts_short="-d -q -F -h"
>>>> +
>>>> +    opts_long="--debug --quiet --force --color --help"
>>>> +
>>>> +    subcommands="layerindex-fetch layerindex-show-depends add-layer \
>>>> +                    remove-layer flatten show-layers show-overlayed \
>>>> +                        show-recipes show-appends show-cross-depends \
>>>> +                        create-layer"
>>>> +
>>>> +    colors="auto always never"
>>>> +
>>>> +    opts_long_show_overlayed="--help --filenames --same-version"
>>>> +    opts_short_show_overlayed="-h -f -s"
>>>> +
>>>> +    opts_long_show_recipes="--help --filenames --multiple --inherits"
>>>> +    opts_short_show_recipes="-h -f -m -i"
>>>> +
>>>> +    opts_long_show_layerindex_fetch="--help --show-only --branch --ignore"
>>>> +    opts_short_show_layerindex_fetch="-h -n -b -i"
>>>> +
>>>> +    opts_long_add_layer="--help --priority --example-recipe-name
>>>> --example-recipe-version"
>>>> +    opts_short_add_layer="-h"
>>>> +
>>>> +    opts_long_show_cross_depends="--help --filenames --ignore"
>>>> +    opts_short_show_cross_depends="-h -f -i"
>>>> +
>>>> +    opts_long_show_layerindex_show_depends="--help --branch"
>>>> +    opts_short_show_layerindex_show_depends="-h -b"
>>>> +
>>>> +    opts_long_show_create_layer="--help --priority --example-recipe-name
>>>> --example-recipe-version"
>>>> +    opts_short_show_create_layer="-h -p -e -v"
>>>> +
>>>> +    bb_class_files=".bb_class_files"
>>>> +
>>>> +    _get_classes() {
>>>> +        find $BBPATH/../meta*/classes/ -name *.bbclass -exec basename {} \;
>>>> | sed 's/.bbclass//' > $bb_class_files
>>>> +    }
>>>> +
>>>> +    if [[ "${COMP_WORDS[@]}" =~ show-recipes ]] ; then
>>>> +        if [[ "$prev" == "--inherits" ]] || [[ "$prev" == "-i" ]]; then
>>>> +            _get_classes
>>>> +            classes=$(cat $bb_class_files)
>>>> +            COMPREPLY=( $(compgen -W "${classes}" -- ${cur}) )
>>>> +            return 0
>>>> +        fi
>>>> +    fi
>>>> +
>>>> +    if [[ "${COMP_WORDS[1]}" =~
>>>> show-layers|show-appends|remove-layer|flatten ]]; then
>>>> +        case "$cur" in
>>>> +            "--"*)
>>>> +                COMPREPLY=( $(compgen -W "--help" -- ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +            "-"*)
>>>> +                COMPREPLY=( $(compgen -W "-h" -- ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +        esac
>>>> +    elif [[ "${COMP_WORDS[1]}" == "add-layer" ]]; then
>>>> +        case "$cur" in
>>>> +            "--"*|"")
>>>> +                COMPREPLY=( $(compgen -W "${opts_long_add_layer}" --
>>>> ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +            "-"*)
>>>> +                COMPREPLY=( $(compgen -W "${opts_short_add_layer}" --
>>>> ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +        esac
>>>> +    elif [[ "${COMP_WORDS[1]}" == "show-overlayed" ]]; then
>>>> +        case "$cur" in
>>>> +            "--"*|"")
>>>> +                COMPREPLY=( $(compgen -W "${opts_long_show_overlayed}" --
>>>> ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +            "-"*)
>>>> +                COMPREPLY=( $(compgen -W "${opts_short_show_overlayed}" --
>>>> ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +        esac
>>>> +    elif [[ "${COMP_WORDS[1]}" == "show-recipes" ]]; then
>>>> +        case "$cur" in
>>>> +            "--"*|"")
>>>> +                COMPREPLY=( $(compgen -W "${opts_long_show_recipes}" --
>>>> ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +            "-"*)
>>>> +                COMPREPLY=( $(compgen -W "${opts_short_show_recipes}" --
>>>> ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +        esac
>>>> +    elif [[ "${COMP_WORDS[1]}" == "show-cross-depends" ]]; then
>>>> +        case "$cur" in
>>>> +            "--"*|"")
>>>> +                COMPREPLY=( $(compgen -W "${opts_long_show_cross_depends}"
>>>> -- ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +            "-"*)
>>>> +                COMPREPLY=( $(compgen -W "${opts_short_show_cross_depends}"
>>>> -- ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +        esac
>>>> +    elif [[ "${COMP_WORDS[1]}" == "layerindex-fetch" ]]; then
>>>> +        case "$cur" in
>>>> +            "--"*|"")
>>>> +                COMPREPLY=( $(compgen -W
>>>> "${opts_long_show_layerindex_fetch}" -- ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +            "-"*)
>>>> +                COMPREPLY=( $(compgen -W
>>>> "${opts_short_show_layerindex_fetch}" -- ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +        esac
>>>> +    elif [[ "${COMP_WORDS[1]}" == "layerindex-show-depends" ]]; then
>>>> +        case "$cur" in
>>>> +            "--"*|"")
>>>> +                COMPREPLY=( $(compgen -W
>>>> "${opts_long_show_layerindex_show_depends}" -- ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +            "-"*)
>>>> +                COMPREPLY=( $(compgen -W
>>>> "${opts_short_show_layerindex_show_depends}" -- ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +        esac
>>>> +    elif [[ "${COMP_WORDS[1]}" == "create-layer" ]]; then
>>>> +        case "$cur" in
>>>> +            "--"*|"")
>>>> +                COMPREPLY=( $(compgen -W "${opts_long_show_create_layer}"
>>>> -- ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +            "-"*)
>>>> +                COMPREPLY=( $(compgen -W "${opts_short_show_create_layer}"
>>>> -- ${cur}) )
>>>> +                return 0
>>>> +            ;;
>>>> +        esac
>>>> +    fi
>>>> +
>>>> +    case "$prev" in
>>>> +        "-c"|"--color")
>>>> +            COMPREPLY=( $(compgen -W "${colors}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +    esac
>>>> +
>>>> +    case "$cur" in
>>>> +        "--"*)
>>>> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +        "-"*)
>>>> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +    esac
>>>> +
>>>> +    if [[ ${prev} == "bitbake-layers" ]]; then
>>>> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
>>>> +        return 0
>>>> +    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
>>>> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
>>>> +        return 0
>>>> +    fi
>>>> +}
>>>> +complete -F _bitbake_layers bitbake-layers
>>>> \ No newline at end of file
>>>> diff --git a/contrib/completion/bash/bitbake_prserv_completion
>>>> b/contrib/completion/bash/bitbake_prserv_completion
>>>> new file mode 100644
>>>> index 00000000..3bca1197
>>>> --- /dev/null
>>>> +++ b/contrib/completion/bash/bitbake_prserv_completion
>>>> @@ -0,0 +1,76 @@
>>>> +#!bash
>>>> +# Bash completion support for bitbake-prserv tool,
>>>> +# compatible with Bitbake 1.39.1.
>>>> +#
>>>> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
>>>> +#
>>>> +# Distributed under the MIT License (MIT)
>>>> +#
>>>> +
>>>> +_bitbake_prserv()
>>>> +{
>>>> +    local cur prev opts_short opts_long subcommands file_default
>>>> log_default log_levels
>>>> +
>>>> +    COMPREPLY=()
>>>> +
>>>> +    cur="${COMP_WORDS[COMP_CWORD]}"
>>>> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
>>>> +
>>>> +    opts_short="-h -f -l"
>>>> +
>>>> +    opts_long="--version --help --file= --log= --loglevel= --start \
>>>> +                  --stop --host= --port="
>>>> +
>>>> +    subcommands="layerindex-fetch layerindex-show-depends add-layer \
>>>> +                    remove-layer flatten show-layers show-overlayed \
>>>> +                        show-recipes show-appends show-cross-depends \
>>>> +                        create-layer"
>>>> +
>>>> +    file_default="prserv.sqlite3"
>>>> +    log_default="prserv.log"
>>>> +    log_levels="CRITICAL ERROR WARNING INFO DEBUG"
>>>> +
>>>> +    if [[ "$prev" == "=" ]]; then
>>>> +        prev="${COMP_WORDS[COMP_CWORD -2]}"
>>>> +    elif [[ "$cur" == "=" ]]; then
>>>> +        cur=""
>>>> +    fi
>>>> +
>>>> +    case "$prev" in
>>>> +        "-f"|"--file")
>>>> +            COMPREPLY=( $(compgen -W "${file_default}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +        "-l"|"--log")
>>>> +            COMPREPLY=( $(compgen -W "${log_default}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +        "--loglevel")
>>>> +            COMPREPLY=( $(compgen -W "${log_levels}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +    esac
>>>> +
>>>> +    case "$cur" in
>>>> +        "--"*|"")
>>>> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
>>>> +            if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == "--"*"=" ]] ;
>>>> then
>>>> +                compopt -o nospace
>>>> +            fi
>>>> +            return 0
>>>> +        ;;
>>>> +        "-"*)
>>>> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +    esac
>>>> +
>>>> +    if [[ ${prev} == "bitbake-layers" ]]; then
>>>> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
>>>> +        return 0
>>>> +    elif [[ ! ${subcommands} =~ [[:space:]]${cur}[[:space:]] ]]; then
>>>> +        COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) )
>>>> +        return 0
>>>> +    fi
>>>> +}
>>>> +complete -F _bitbake_prserv bitbake-prserv
>>>> \ No newline at end of file
>>>> diff --git a/contrib/completion/bash/bitbake_selftest_completion
>>>> b/contrib/completion/bash/bitbake_selftest_completion
>>>> new file mode 100644
>>>> index 00000000..8b6bf641
>>>> --- /dev/null
>>>> +++ b/contrib/completion/bash/bitbake_selftest_completion
>>>> @@ -0,0 +1,34 @@
>>>> +#!bash
>>>> +# Bash completion support for bitbake-selftest tool,
>>>> +# compatible with Bitbake version 1.39.1.
>>>> +#
>>>> +# Copyright (C) 2018 Lukasz Gardon <lukasz.gardon@gmail.com>
>>>> +#
>>>> +# Distributed under the MIT License (MIT)
>>>> +#
>>>> +
>>>> +_bitbake_selftest()
>>>> +{
>>>> +    local cur prev opts_short opts_long
>>>> +
>>>> +    COMPREPLY=()
>>>> +
>>>> +    cur="${COMP_WORDS[COMP_CWORD]}"
>>>> +    prev="${COMP_WORDS[COMP_CWORD-1]}"
>>>> +
>>>> +    opts_short="-h -v -q -f -c"
>>>> +
>>>> +    opts_long="--help --verbose --quiet --locals --failfast --catch"
>>>> +
>>>> +    case "$cur" in
>>>> +        "--"*)
>>>> +            COMPREPLY=( $(compgen -W "${opts_long}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +        "-"*)
>>>> +            COMPREPLY=( $(compgen -W "${opts_short}" -- ${cur}) )
>>>> +            return 0
>>>> +        ;;
>>>> +    esac
>>>> +}
>>>> +complete -F _bitbake_selftest bitbake-selftest
>>>> \ No newline at end of file
>>>> --
>>>> 2.18.0
>>>> 
>>>> --
>>>> _______________________________________________
>>>> bitbake-devel mailing list
>>>> bitbake-devel@lists.openembedded.org
>>>> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
>>>> 
>>>> 
>> 
> 


[-- Attachment #2: Type: text/html, Size: 51842 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Add files supporting bash completion for bitbake tools
  2018-09-05 17:24           ` Łukasz Gardoń
@ 2018-09-05 17:28             ` richard.purdie
       [not found]               ` <D234347A-BA5D-4001-9F81-2E1D393CCB25@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: richard.purdie @ 2018-09-05 17:28 UTC (permalink / raw)
  To: Łukasz Gardoń, Alexander Kanavin, bitbake-devel

On Wed, 2018-09-05 at 19:24 +0200, Łukasz Gardoń wrote:
> Richard, may I ask You kindly help here to decide if such files
> should be stored in bitbake repository ?

My initial reaction is what the upstream policy for bash completions
is?

We don't tend to install bitbake as a traditional programme so users
will probably struggle to access these if they're in bitbake. If they
were in upstream bash-completion, it would likely make for a better
experience.

So I'd probably ask upstream as that is probably the preferred
location. If they won't take them for some reason, bitbake would be a
second choice.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Add files supporting bash completion for bitbake tools
       [not found]                               ` <CAHTiZf+DyebwL3N9y15RgvJZKnTx4Bh+XhqEo8FVxg5w_C=L7w@mail.gmail.com>
@ 2018-09-07 11:46                                 ` richard.purdie
  0 siblings, 0 replies; 7+ messages in thread
From: richard.purdie @ 2018-09-07 11:46 UTC (permalink / raw)
  To: Łukasz Gardoń, bitbake-devel; +Cc: ville.skytta

On Fri, 2018-09-07 at 12:38 +0200, Łukasz Gardoń wrote:
> Indeed, poky repository is combined with using combo layer tool, I
> forger about this fact. 
> 
> So how fell can I prepare a change with adding completion files for
> BitBake into bitbake repository (just storing those files under
> contrib dir). And also prepare a change for oe-core also with adding
> complete files under contrib dir (e.g for devtool) and adapt env
> scripts.
> 
> I am volunteering my self for keeping update these files if this is
> possible.

I guess I'm ok in principle to do something like this and happy to have
a maintainer. I did look at the patches and I don't think they're
acceptable in their current form though.

The list of tasks is hardcoded whilst in reality different recipes have
different tasks and the available tasks is metadata defined. I do not
want to see a hardcoded list of tasks. The expression to obtain recipe
data is also rather ugly.

Ultimately our plan is to have bitbake be memory resident so there is
no real parsing overhead for queries. If that were the case we'd be
able to get correct recipe/task information from bitbake.

So in principle, I'm open to the idea but we likely need memory
resident bitbake and a helper to pull the info you need for correct
completion data directly from bitbake rather than guessing.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-09-07 11:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-01 13:36 [] Add files supporting bash completion for bitbake tools Łukasz Gardoń
2018-09-01 19:33 ` Alexander Kanavin
     [not found]   ` <94B3180E-9326-43AC-9780-39A3E2D9F850@gmail.com>
2018-09-03  9:25     ` Alexander Kanavin
     [not found]       ` <1577859A-5F16-4E3F-8C23-1ECB099AB770@gmail.com>
2018-09-03 19:25         ` Łukasz Gardoń
2018-09-05 17:24           ` Łukasz Gardoń
2018-09-05 17:28             ` richard.purdie
     [not found]               ` <D234347A-BA5D-4001-9F81-2E1D393CCB25@gmail.com>
     [not found]                 ` <6CD09F44-529F-4395-8342-5C295F7B2BFD@gmail.com>
     [not found]                   ` <CABr9L5DzAv5RtZZv3HBHTO3fuKrQWeazT1WZ4czYL1kpKzyhSg@mail.gmail.com>
     [not found]                     ` <7ed5a587326097169c70965e34e0a690f0d549e5.camel@linuxfoundation.org>
     [not found]                       ` <CABr9L5Cfa5Z-gQTOZeMwJ0jV-r91XboZAaT8oM0HW5Rn4mcy2A@mail.gmail.com>
     [not found]                         ` <645d033f38db0a4389002c2c42ef8f83aa619045.camel@linuxfoundation.org>
     [not found]                           ` <CAHTiZf+x-vUPHTmR=yYFcSday9v4Pw0J88oz3HvzN9cuTKenTw@mail.gmail.com>
     [not found]                             ` <560fd234a8e60cc339d58db20b0c684564df6da7.camel@linuxfoundation.org>
     [not found]                               ` <CAHTiZf+DyebwL3N9y15RgvJZKnTx4Bh+XhqEo8FVxg5w_C=L7w@mail.gmail.com>
2018-09-07 11:46                                 ` richard.purdie

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.