scripts: misc help and auto-complete fixes
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Apr 02 00:18:26 2010 +0200 (2010-04-02)
changeset 1876a6a4beab3125
parent 1875 5b5fa5df819b
child 1877 b579a5cb53d1
scripts: misc help and auto-complete fixes

- don't list samples in the main help screen
- improve the samples listing in list-samples
- don't document the 'config' action, it's long dead
- document the 'V' environment variable
- improve on START, STOP and PREFIX environment variables
- add PREFIX and V to autocomplete
- advertise auto-complete at install time
Makefile.in
ct-ng.comp
ct-ng.in
samples/samples.mk
scripts/showSamples.sh
steps.mk
     1.1 --- a/Makefile.in	Fri Apr 02 22:39:53 2010 +0200
     1.2 +++ b/Makefile.in	Fri Apr 02 00:18:26 2010 +0200
     1.3 @@ -182,7 +182,7 @@
     1.4  #--------------------------------------
     1.5  # Install rules
     1.6  
     1.7 -real-install: $(patsubst %,install-%,$(TARGETS))
     1.8 +real-install: $(patsubst %,install-%,$(TARGETS)) install-post
     1.9  
    1.10  install-bin: $(DESTDIR)$(BINDIR)
    1.11  	@echo "  INST   'ct-ng'"
    1.12 @@ -232,6 +232,10 @@
    1.13  	@echo "  MKDIR  '$@'"
    1.14  	@$(install) -m 755 -d "$@"
    1.15  
    1.16 +install-post:
    1.17 +	@echo
    1.18 +	@echo "For auto-completion, do not forget to install 'ct-ng.comp'"
    1.19 +	@echo "into you 'bash_completion.d'"
    1.20  
    1.21  #--------------------------------------
    1.22  # Uninstall rules
     2.1 --- a/ct-ng.comp	Fri Apr 02 22:39:53 2010 +0200
     2.2 +++ b/ct-ng.comp	Fri Apr 02 00:18:26 2010 +0200
     2.3 @@ -6,8 +6,8 @@
     2.4      cur=$(_get_cword)
     2.5      prev=${COMP_WORDS[COMP_CWORD-1]}
     2.6  
     2.7 -    samples=$( ${COMP_WORDS[0]} list-samples 2>/dev/null    \
     2.8 -               |sed -r -e 's/^(.*) \(host: (.*)\)$/\2,\1/;' \
     2.9 +    samples=$( "${COMP_WORDS[0]}" list-samples 2>/dev/null  \
    2.10 +               |tail -n +2 |sed -e '/^ /d; s/ .*//;'        \
    2.11               )
    2.12      show_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1show-/g;')
    2.13      build_samples=$(echo "${samples}" |sed -r -e 's/(^| )/\1build-/g;')
    2.14 @@ -22,7 +22,7 @@
    2.15               clean distclean wiki-samples updatetools
    2.16               tarball version'
    2.17  
    2.18 -    vars="RESTART= STOP="
    2.19 +    vars="RESTART= STOP= PREFIX= V="
    2.20  
    2.21      ct_ng_opts="${samples} ${show_samples} ${build_samples}
    2.22                  ${steps} ${start_steps} ${stop_steps}
     3.1 --- a/ct-ng.in	Fri Apr 02 22:39:53 2010 +0200
     3.2 +++ b/ct-ng.in	Fri Apr 02 00:18:26 2010 +0200
     3.3 @@ -98,7 +98,7 @@
     3.4  
     3.5  help-tail::
     3.6  	@echo
     3.7 -	@echo  'Use action "config" or "menuconfig" to configure crosstool-NG'
     3.8 +	@echo  'Use action "menuconfig" to configure crosstool-NG'
     3.9  	@echo  'Use action "build" to build your toolchain'
    3.10  	@echo  'Use action "version" to see the version'
    3.11  	@echo  'See "man 1 ct-ng" for some help as well'
    3.12 @@ -123,6 +123,9 @@
    3.13  	@echo  '  tarball            - Build a tarball of the configured toolchain'
    3.14  
    3.15  help-env::
    3.16 +	@echo  '  V=0|1|2            - 0 => show only human-readable messages (default)'
    3.17 +	@echo  '                       1 => show only the commands being executed'
    3.18 +	@echo  '                       2 => show both'
    3.19  
    3.20  # End help system
    3.21  
     4.1 --- a/samples/samples.mk	Fri Apr 02 22:39:53 2010 +0200
     4.2 +++ b/samples/samples.mk	Fri Apr 02 00:18:26 2010 +0200
     4.3 @@ -19,19 +19,16 @@
     4.4  
     4.5  help-samples::
     4.6  	@echo  '  list-samples       - prints the list of all samples (for scripting)'
     4.7 -	@echo  '  show-<sample>      - show a brief overview of <sample> (list below)'
     4.8 -	@echo  '  <sample>           - preconfigure crosstool-NG with <sample> (list below)'
     4.9 -	@echo  '  build-all[.#]      - Build *all* samples (list below) and install in'
    4.10 +	@echo  '  show-<sample>      - show a brief overview of <sample> (list with list-samples)'
    4.11 +	@echo  '  <sample>           - preconfigure crosstool-NG with <sample> (list with list-samples)'
    4.12 +	@echo  '  build-all[.#]      - Build *all* samples (list with list-samples) and install in'
    4.13  	@echo  '                       $${CT_PREFIX} (which you must set)'
    4.14 -	@echo  '  Available samples:'
    4.15 -	@$(CT_LIB_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
    4.16  
    4.17  help-distrib::
    4.18  	@echo  '  wiki-samples       - Print a DokuWiki table of samples'
    4.19  
    4.20  help-env::
    4.21 -	@echo  '  CT_PREFIX          - directory in which to auto-install samples'
    4.22 -	@echo  '                       (see action "build-all", above).'
    4.23 +	@echo  '  CT_PREFIX=dir      - install samples in dir (see action "build-all", above).'
    4.24  
    4.25  # ----------------------------------------------------------
    4.26  # This part deals with printing samples information
    4.27 @@ -54,7 +51,7 @@
    4.28  # print the list of all available samples
    4.29  PHONY += list-samples
    4.30  list-samples: FORCE
    4.31 -	@echo $(CT_SAMPLES) |$(sed) -r -e 's/ /\n/g;' |sed -r -e 's/(.*),(.*)/\2 \(host: \1\)/;'
    4.32 +	$(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh $(CT_SAMPLES)
    4.33  
    4.34  wiki-samples:
    4.35  	$(SILENT)$(CT_LIB_DIR)/scripts/showSamples.sh -w $(CT_SAMPLES)
     5.1 --- a/scripts/showSamples.sh	Fri Apr 02 22:39:53 2010 +0200
     5.2 +++ b/scripts/showSamples.sh	Fri Apr 02 00:18:26 2010 +0200
     5.3 @@ -30,10 +30,10 @@
     5.4              ;;
     5.5          *)  if [ -f "${CT_TOP_DIR}/samples/${sample}/crosstool.config" ]; then
     5.6                  sample_top="${CT_TOP_DIR}"
     5.7 -                sample_type="l"
     5.8 +                sample_type="L"
     5.9              else
    5.10                  sample_top="${CT_LIB_DIR}"
    5.11 -                sample_type="g"
    5.12 +                sample_type="G"
    5.13              fi
    5.14              . "${sample_top}/samples/${sample}/crosstool.config"
    5.15              ;;
    5.16 @@ -174,6 +174,8 @@
    5.17      printf "^  Initially\\\\\\\\ reported by  "
    5.18      printf "^  Last\\\\\\\\ updated  "
    5.19      echo   "^"
    5.20 +elif [ -z "${opt}" ]; then
    5.21 +    printf "%-*s  Status\n" ${width} "Sample name"
    5.22  fi
    5.23  
    5.24  for sample in "${@}"; do
    5.25 @@ -184,8 +186,8 @@
    5.26      printf "^ Total: ${#@} samples  || **X**: sample uses features marked as being EXPERIMENTAL.\\\\\\\\ **B**: sample is curently BROKEN. |||||||||||||"
    5.27      echo   ""
    5.28  elif [ -z "${opt}" ]; then
    5.29 -    echo '      l (local)       : sample was found in current directory'
    5.30 -    echo '      g (global)      : sample was installed with crosstool-NG'
    5.31 +    echo '      L (Local)       : sample was found in current directory'
    5.32 +    echo '      G (Global)      : sample was installed with crosstool-NG'
    5.33      echo '      X (EXPERIMENTAL): sample may use EXPERIMENTAL features'
    5.34      echo '      B (BROKEN)      : sample is currently broken'
    5.35  fi
     6.1 --- a/steps.mk	Fri Apr 02 22:39:53 2010 +0200
     6.2 +++ b/steps.mk	Fri Apr 02 00:18:26 2010 +0200
     6.3 @@ -8,8 +8,8 @@
     6.4  	@echo  '  list-steps         - List all build steps'
     6.5  
     6.6  help-env::
     6.7 -	@echo  '  STOP               - Stop the build just after this step'
     6.8 -	@echo  '  RESTART            - Restart the build just before this step'
     6.9 +	@echo  '  STOP=step          - Stop the build just after this step (list with list-steps)'
    6.10 +	@echo  '  RESTART=step       - Restart the build just before this step (list with list-steps)'
    6.11  
    6.12  # ----------------------------------------------------------
    6.13  # The steps list