diff --git a/docs/develop/gettingstarted.rst b/docs/develop/gettingstarted.rst index b625a72c98..4cc818fda1 100644 --- a/docs/develop/gettingstarted.rst +++ b/docs/develop/gettingstarted.rst @@ -306,6 +306,22 @@ As an example, you can build and test the unix minimal port with: $ tools/ci.sh unix_minimal_build unix_minimal_run_tests +If you use the bash shell, you can add a ``ci`` command with tab completion: + +.. code-block:: bash + + $ eval `tools/ci.sh --bash-completion` + $ ci unix_cov + +This will complete the ci step name to ``unix_coverage_``. +Pressing tab a second time will show the list of matching steps: + +.. code-block:: bash + + $ ci unix_coverage_ + unix_coverage_32bit_build + unix_coverage_32bit_run_native_mpy_tests… + Folder structure ---------------- diff --git a/tools/ci.sh b/tools/ci.sh index 3e34bd6fa8..6ecf8cc67c 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -1005,11 +1005,22 @@ function _ci_help { exit } +function _ci_bash_completion { + echo "alias ci=\"$(readlink -f "$0")\"; complete -W '$(grep '^function ci_' $0 | awk '{print $2}' | sed 's/^ci_//')' ci" +} + function _ci_main { case "$1" in (-h|-?|--help) _ci_help ;; + (--bash-completion) + _ci_bash_completion + ;; + (-*) + echo "Unknown option: $1" 1>&2 + exit 1 + ;; (*) set -e cd $(dirname "$0")/..