浏览代码

bash-completion: Future-proof --help-*-list "cXXXX version" filtering

A future version of CMake may not print the "cmake version" line at the
beginning of the --help-*-list output.  Filter out the line with 'grep'
instead of 'tail' to tolerate output from versions of CMake with and
without the version line.  Match "cmake version", "cpack version", and
"ctest version" in each corresponding completion script.
Brad King 12 年之前
父节点
当前提交
a8d7141d2b
共有 3 个文件被更改,包括 8 次插入8 次删除
  1. 4 4
      Docs/bash-completion/cmake
  2. 3 3
      Docs/bash-completion/cpack
  3. 1 1
      Docs/bash-completion/ctest

+ 4 - 4
Docs/bash-completion/cmake

@@ -111,12 +111,12 @@ _cmake()
             ;;
         --help-command)
             COMPREPLY=( $( compgen -W '$( cmake --help-command-list 2>/dev/null|
-                tail -n +2 )' -- "$cur" ) )
+                grep -v "^cmake version " )' -- "$cur" ) )
             return
             ;;
         --help-module)
             COMPREPLY=( $( compgen -W '$( cmake --help-module-list 2>/dev/null|
-                tail -n +2 )' -- "$cur" ) )
+                grep -v "^cmake version " )' -- "$cur" ) )
             return
             ;;
          --help-policy)
@@ -126,12 +126,12 @@ _cmake()
             ;;
          --help-property)
             COMPREPLY=( $( compgen -W '$( cmake --help-property-list \
-                2>/dev/null | tail -n +2 )' -- "$cur" ) )
+                2>/dev/null | grep -v "^cmake version " )' -- "$cur" ) )
             return
             ;;
          --help-variable)
             COMPREPLY=( $( compgen -W '$( cmake --help-variable-list \
-                2>/dev/null | tail -n +2 )' -- "$cur" ) )
+                2>/dev/null | grep -v "^cmake version " )' -- "$cur" ) )
             return
             ;;
     esac

+ 3 - 3
Docs/bash-completion/cpack

@@ -20,7 +20,7 @@ _cpack()
         -D)
             [[ $cur == *=* ]] && return # no completion for values
             COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
-                2>/dev/null | tail -n +2 )' -S = -- "$cur" ) )
+                2>/dev/null | grep -v "^cpack version " )' -S = -- "$cur" ) )
             compopt -o nospace
             return
             ;;
@@ -38,12 +38,12 @@ _cpack()
             ;;
         --help-command)
             COMPREPLY=( $( compgen -W '$( cpack --help-command-list 2>/dev/null|
-                tail -n +2 )' -- "$cur" ) )
+                grep -v "^cpack version " )' -- "$cur" ) )
             return
             ;;
         --help-variable)
             COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
-                2>/dev/null | tail -n +2 )' -- "$cur" ) )
+                2>/dev/null | grep -v "^cpack version " )' -- "$cur" ) )
             return
             ;;
     esac

+ 1 - 1
Docs/bash-completion/ctest

@@ -63,7 +63,7 @@ _ctest()
             ;;
         --help-command)
             COMPREPLY=( $( compgen -W '$( ctest --help-command-list 2>/dev/null|
-                tail -n +2 )' -- "$cur" ) )
+                grep -v "^ctest version " )' -- "$cur" ) )
             return
             ;;
     esac