Repository: karaf Updated Branches: refs/heads/karaf-4.1.x c1f081cff -> 257a994a1
[KARAF-5223] "Error in initialization script" messages printed to the main console when clients connect through ssh Project: http://git-wip-us.apache.org/repos/asf/karaf/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/257a994a Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/257a994a Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/257a994a Branch: refs/heads/karaf-4.1.x Commit: 257a994a19ac2fc1853df80c14463104878fc16d Parents: c1f081c Author: Guillaume Nodet <gno...@apache.org> Authored: Mon Jun 26 17:12:55 2017 +0200 Committer: Guillaume Nodet <gno...@apache.org> Committed: Mon Jun 26 17:14:13 2017 +0200 ---------------------------------------------------------------------- .../etc/scripts/shell.completion.script | 364 ++++++++++--------- .../resources/resources/etc/shell.init.script | 31 +- 2 files changed, 202 insertions(+), 193 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/257a994a/assemblies/features/base/src/main/resources/resources/etc/scripts/shell.completion.script ---------------------------------------------------------------------- diff --git a/assemblies/features/base/src/main/resources/resources/etc/scripts/shell.completion.script b/assemblies/features/base/src/main/resources/resources/etc/scripts/shell.completion.script index e8595e5..17b165f 100644 --- a/assemblies/features/base/src/main/resources/resources/etc/scripts/shell.completion.script +++ b/assemblies/features/base/src/main/resources/resources/etc/scripts/shell.completion.script @@ -53,186 +53,190 @@ __set_unset_arguments = { $candidates } +jlineReader = $.reader +if { %(jlineReader != null) } { -complete -c shell:complete -e -complete -c shell:complete -d "Edit command specific completions" -complete -c shell:complete -s c -l command --description "Command to add completion to" -n '__option_not_present -c --command' -a '$.commands' -complete -c shell:complete -s s -l short-option --description "Posix-style option to complete" -n '__option_not_present -s --short-option' -complete -c shell:complete -s l -l long-option --description "GNU-style option to complete" -n '__option_not_present -l --long-option' -complete -c shell:complete -s a -l arguments --description "A list of possible arguments" -n '__option_not_present -a --argument' -complete -c shell:complete -s d -l description --description "Description of this completions" -n '__option_not_present -d --description' -complete -c shell:complete -s h -l help --description "Display help and exit" -n '__option_not_present -h --help' -complete -c shell:complete -s n -l condition --description "The completion should only be used if the specified command has a zero exit status" -n '__option_not_present -n --condition' -complete -c shell:complete -s e -l erase --description "Remove completion" -n '__option_not_present -e --erase' + complete -c shell:complete -e + complete -c shell:complete -d "Edit command specific completions" + complete -c shell:complete -s c -l command --description "Command to add completion to" -n '__option_not_present -c --command' -a '$.commands' + complete -c shell:complete -s s -l short-option --description "Posix-style option to complete" -n '__option_not_present -s --short-option' + complete -c shell:complete -s l -l long-option --description "GNU-style option to complete" -n '__option_not_present -l --long-option' + complete -c shell:complete -s a -l arguments --description "A list of possible arguments" -n '__option_not_present -a --argument' + complete -c shell:complete -s d -l description --description "Description of this completions" -n '__option_not_present -d --description' + complete -c shell:complete -s h -l help --description "Display help and exit" -n '__option_not_present -h --help' + complete -c shell:complete -s n -l condition --description "The completion should only be used if the specified command has a zero exit status" -n '__option_not_present -n --condition' + complete -c shell:complete -s e -l erase --description "Remove completion" -n '__option_not_present -e --erase' -complete -c shell:history -e -complete -c shell:history -d "Show and manipulate command history" -complete -c shell:history -l clear --description "Clear history" -n '__option_not_present --clear' -complete -c shell:history -l save --description "Save history" -n '__option_not_present --save' + complete -c shell:history -e + complete -c shell:history -d "Show and manipulate command history" + complete -c shell:history -l clear --description "Clear history" -n '__option_not_present --clear' + complete -c shell:history -l save --description "Save history" -n '__option_not_present --save' -complete -c shell:setopt -e -complete -c shell:setopt -d "Set or view set shell options" -complete -c shell:setopt -a '__set_unset_arguments' - -complete -c shell:unsetopt -e -complete -c shell:unsetopt -d "Unset or view unset shell options" -complete -c shell:unsetopt -a '__set_unset_arguments' - -complete -c shell:cat -e -complete -c shell:cat -d "Concatenate and print files" -complete -c shell:cat -s n "Number the output lines, starting at 1" -complete -c shell:cat -a '__files' - -complete -c shell:pwd -e -complete -c shell:pwd -d "Get current directory" - -complete -c shell:ls -e -complete -c shell:ls -d "List files" - -complete -c shell:cd -e -complete -c shell:cd -d "Change current directory" -complete -c shell:cd -a '__directories' - -complete -c shell:sleep -e -complete -c shell:sleep -d "Pause execution for the specified amount of time" - -complete -c shell:echo -e -complete -c shell:echo -d "Write arguments to the standard output" -complete -c shell:echo -s n -d "No trailing new line" - -complete -c shell:grep -e -complete -c shell:grep -d "File pattern searcher" -# TODO - -complete -c shell:sort -e -complete -c shell:sort -d "Sort lines of text files" -# TODO - -complete -c shell:gosh -e -complete -c shell:gosh -d "Execute script with arguments in a new session" -# TODO - -complete -c shell:sh -e -complete -c shell:sh -d "Execute script with arguments in a new session" -# TODO - -complete -c shell:source -e -complete -c shell:source -d "Execute script with arguments" -# TODO - -# TODO: format getopt new set tac type addcommand removeCommand eval - -complete -c shell:break -e -complete -c shell:break -d "Break from a loop" - -complete -c shell:continue -e -complete -c shell:continue -d "Continue to next iteration in a loop" - -complete -c shell:each -e -complete -c shell:each -d "Loop and execute script on the specified elements" - -complete -c shell:if -e -complete -c shell:if -d "Conditionaly execute a script" - -complete -c shell:new -e -complete -c shell:new -d "Creates new instance of the given java class" - -complete -c shell:not -e -complete -c shell:not -d "Negates the result of a script" - -complete -c shell:throw -e -complete -c shell:throw -d "Throws an exception" - -complete -c shell:try -e -complete -c shell:try -d "Try executing a script and catch any exception" - -complete -c shell:until -e -complete -c shell:until -d "Loop and execute script until a condition is satisfied" - -complete -c shell:while -e -complete -c shell:while -d "Loop and execute script while a condition is satisfied" - -complete -c shell:less -e -complete -c shell:less -d "File pager" -complete -c shell:less -s e -l quit-at-eof --description "Exit on second EOF" -complete -c shell:less -s E -l QUIT-AT-EOF --description "Exit on EOF" -complete -c shell:less -s q -l quiet -l silent --description "Silent mode" -complete -c shell:less -s Q -l QUIET -l SILENT --description "Completely silent" -complete -c shell:less -s S -l chop-long-lines --description "Do not fold long lines" -complete -c shell:less -s i -l ignore-case --description "Search ignores lowercase case" -complete -c shell:less -s I -l IGNORE-CASE --description "Search ignores all case" -complete -c shell:less -s x -l tabs --description "Set tab stops" -complete -c shell:less -s N -l LINE-NUMBERS --description "Display line number for each line" -complete -c shell:less -a '__files' - -complete -c shell:nano -e -complete -c shell:nano -d "File editor" -complete -c shell:nano -a '__files' - -complete -c shell:keymap -e -complete -c shell:keymap -d "Manipulate keymaps" -complete -c shell:keymap -s N --description "Create a new keymap" -n '__option_not_present -N -d -D -l -r -s -A' -complete -c shell:keymap -s d --description "Delete existing keymaps and reset to default state" -n '__option_not_present -N -d -D -l -r -s -A' -complete -c shell:keymap -s D --description "Delete named keymaps" -n '__option_not_present -N -d -D -l -r -s -A' -complete -c shell:keymap -s l --description "List existing keymap names" -n '__option_not_present -N -d -D -l -r -s -A' -complete -c shell:keymap -s r --description "Unbind specified in-strings" -n '__option_not_present -N -d -D -l -r -s -A' -complete -c shell:keymap -s s --description "Bind each in-string to each out-string" -n '__option_not_present -N -d -D -l -r -s -A' -complete -c shell:keymap -s A --description "Create alias to keymap" -n '__option_not_present -N -d -D -l -r -s -A' -complete -c shell:keymap -s e --description "Select emacs keymap and bind it to main" -n '__option_not_present -e -a -v -M' -complete -c shell:keymap -s v --description "Select viins keymap and bind it to main" -n '__option_not_present -e -a -v -M' -complete -c shell:keymap -s a --description "Select vicmd keymap" -n '__option_not_present -e -a -v -M' -complete -c shell:keymap -s M --description "Specify keymap to select" -n '__option_not_present -e -a -v -M' -a '(keymap -l | tac) split " "' -complete -c shell:keymap -s R --description "Interpret in-strings as ranges" -complete -c shell:keymap -s p --description "List bindings which have given key sequence as a a prefix" -complete -c shell:keymap -s L --description "Output in form of keymap commands" - -complete -c shell:widget -e -complete -c shell:widget -d "Manipulate widgets" -complete -c shell:widget -s N --description "Create a new widget" -n '__option_not_present -N -A -D -U -l' -complete -c shell:widget -s A --description "Create alias to widget" -n '__option_not_present -N -A -D -U -l' -complete -c shell:widget -s D --description "Delete widgets" -n '__option_not_present -N -A -D -U -l' -complete -c shell:widget -s U --description "Push characters to the stack" -n '__option_not_present -N -A -D -U -l' -complete -c shell:widget -s l --description "List user-defined widgets" -n '__option_not_present -N -A -D -U -l' -complete -c shell:widget -s a --description "With -l, list all widgets" -n '__option_not_present -l' - -complete -c shell:bg -e -complete -c shell:bg -d "Put job in background" - -complete -c shell:fg -e -complete -c shell:fg -d "Put job in foreground" - -complete -c shell:jobs -e -complete -c shell:jobs -d "List jobs" - -complete -c shell:clear -e -complete -c shell:clear -d "Clear screen" - -complete -c shell:head -e -complete -c shell:head -d "Displays first lines of file" -complete -c shell:head -s n -l lines --description "Print line counts" -complete -c shell:head -s c -l bytes --description "Print byte counts" -complete -c shell:head -a '__files' - -complete -c shell:tail -e -complete -c shell:tail -d "Displays last lines of file" -complete -c shell:tail -s q -l quiet --description "Suppress headers when printing multiple sources" -complete -c shell:tail -s f -l follow --description "Do not stop at end of file" -complete -c shell:tail -s F -l FOLLOW --description "Follow and check for file renaming or rotation" -complete -c shell:tail -s n -l lines --description "Number of lines to print" -complete -c shell:tail -s c -l bytes --description "Number of bytes to print" -complete -c shell:tail -a '__files' - -complete -c shell:date -e -complete -c shell:date -d "Display date and time" -complete -c shell:date -s u --description "Use UTC" -complete -c shell:date -s r --description "Print the date represented by 'seconds' since January 1, 1970" -complete -c shell:date -s v --description "Adjust date" -complete -c shell:date -s f --description "Use 'input_fmt' to parse 'new_date'" - -complete -c shell:wc -e -complete -c shell:wc -d "Word, line, character, and byte count" -complete -c shell:wc -s n -l lines --description "Print line count" -complete -c shell:wc -s c -l bytes --description "Print byte count" -complete -c shell:wc -s m -l chars --description "Print character count" -complete -c shell:wc -s w -l words --description "Print word count" -complete -c shell:wc -a '__files' + complete -c shell:setopt -e + complete -c shell:setopt -d "Set or view set shell options" + complete -c shell:setopt -a '__set_unset_arguments' + + complete -c shell:unsetopt -e + complete -c shell:unsetopt -d "Unset or view unset shell options" + complete -c shell:unsetopt -a '__set_unset_arguments' + + complete -c shell:cat -e + complete -c shell:cat -d "Concatenate and print files" + complete -c shell:cat -s n "Number the output lines, starting at 1" + complete -c shell:cat -a '__files' + + complete -c shell:pwd -e + complete -c shell:pwd -d "Get current directory" + + complete -c shell:ls -e + complete -c shell:ls -d "List files" + + complete -c shell:cd -e + complete -c shell:cd -d "Change current directory" + complete -c shell:cd -a '__directories' + + complete -c shell:sleep -e + complete -c shell:sleep -d "Pause execution for the specified amount of time" + + complete -c shell:echo -e + complete -c shell:echo -d "Write arguments to the standard output" + complete -c shell:echo -s n -d "No trailing new line" + + complete -c shell:grep -e + complete -c shell:grep -d "File pattern searcher" + # TODO + + complete -c shell:sort -e + complete -c shell:sort -d "Sort lines of text files" + # TODO + + complete -c shell:gosh -e + complete -c shell:gosh -d "Execute script with arguments in a new session" + # TODO + + complete -c shell:sh -e + complete -c shell:sh -d "Execute script with arguments in a new session" + # TODO + + complete -c shell:source -e + complete -c shell:source -d "Execute script with arguments" + # TODO + + # TODO: format getopt new set tac type addcommand removeCommand eval + + complete -c shell:break -e + complete -c shell:break -d "Break from a loop" + + complete -c shell:continue -e + complete -c shell:continue -d "Continue to next iteration in a loop" + + complete -c shell:each -e + complete -c shell:each -d "Loop and execute script on the specified elements" + + complete -c shell:if -e + complete -c shell:if -d "Conditionaly execute a script" + + complete -c shell:new -e + complete -c shell:new -d "Creates new instance of the given java class" + + complete -c shell:not -e + complete -c shell:not -d "Negates the result of a script" + + complete -c shell:throw -e + complete -c shell:throw -d "Throws an exception" + + complete -c shell:try -e + complete -c shell:try -d "Try executing a script and catch any exception" + + complete -c shell:until -e + complete -c shell:until -d "Loop and execute script until a condition is satisfied" + + complete -c shell:while -e + complete -c shell:while -d "Loop and execute script while a condition is satisfied" + + complete -c shell:less -e + complete -c shell:less -d "File pager" + complete -c shell:less -s e -l quit-at-eof --description "Exit on second EOF" + complete -c shell:less -s E -l QUIT-AT-EOF --description "Exit on EOF" + complete -c shell:less -s q -l quiet -l silent --description "Silent mode" + complete -c shell:less -s Q -l QUIET -l SILENT --description "Completely silent" + complete -c shell:less -s S -l chop-long-lines --description "Do not fold long lines" + complete -c shell:less -s i -l ignore-case --description "Search ignores lowercase case" + complete -c shell:less -s I -l IGNORE-CASE --description "Search ignores all case" + complete -c shell:less -s x -l tabs --description "Set tab stops" + complete -c shell:less -s N -l LINE-NUMBERS --description "Display line number for each line" + complete -c shell:less -a '__files' + + complete -c shell:nano -e + complete -c shell:nano -d "File editor" + complete -c shell:nano -a '__files' + + complete -c shell:keymap -e + complete -c shell:keymap -d "Manipulate keymaps" + complete -c shell:keymap -s N --description "Create a new keymap" -n '__option_not_present -N -d -D -l -r -s -A' + complete -c shell:keymap -s d --description "Delete existing keymaps and reset to default state" -n '__option_not_present -N -d -D -l -r -s -A' + complete -c shell:keymap -s D --description "Delete named keymaps" -n '__option_not_present -N -d -D -l -r -s -A' + complete -c shell:keymap -s l --description "List existing keymap names" -n '__option_not_present -N -d -D -l -r -s -A' + complete -c shell:keymap -s r --description "Unbind specified in-strings" -n '__option_not_present -N -d -D -l -r -s -A' + complete -c shell:keymap -s s --description "Bind each in-string to each out-string" -n '__option_not_present -N -d -D -l -r -s -A' + complete -c shell:keymap -s A --description "Create alias to keymap" -n '__option_not_present -N -d -D -l -r -s -A' + complete -c shell:keymap -s e --description "Select emacs keymap and bind it to main" -n '__option_not_present -e -a -v -M' + complete -c shell:keymap -s v --description "Select viins keymap and bind it to main" -n '__option_not_present -e -a -v -M' + complete -c shell:keymap -s a --description "Select vicmd keymap" -n '__option_not_present -e -a -v -M' + complete -c shell:keymap -s M --description "Specify keymap to select" -n '__option_not_present -e -a -v -M' -a '(keymap -l | tac) split " "' + complete -c shell:keymap -s R --description "Interpret in-strings as ranges" + complete -c shell:keymap -s p --description "List bindings which have given key sequence as a a prefix" + complete -c shell:keymap -s L --description "Output in form of keymap commands" + + complete -c shell:widget -e + complete -c shell:widget -d "Manipulate widgets" + complete -c shell:widget -s N --description "Create a new widget" -n '__option_not_present -N -A -D -U -l' + complete -c shell:widget -s A --description "Create alias to widget" -n '__option_not_present -N -A -D -U -l' + complete -c shell:widget -s D --description "Delete widgets" -n '__option_not_present -N -A -D -U -l' + complete -c shell:widget -s U --description "Push characters to the stack" -n '__option_not_present -N -A -D -U -l' + complete -c shell:widget -s l --description "List user-defined widgets" -n '__option_not_present -N -A -D -U -l' + complete -c shell:widget -s a --description "With -l, list all widgets" -n '__option_not_present -l' + + complete -c shell:bg -e + complete -c shell:bg -d "Put job in background" + + complete -c shell:fg -e + complete -c shell:fg -d "Put job in foreground" + + complete -c shell:jobs -e + complete -c shell:jobs -d "List jobs" + + complete -c shell:clear -e + complete -c shell:clear -d "Clear screen" + + complete -c shell:head -e + complete -c shell:head -d "Displays first lines of file" + complete -c shell:head -s n -l lines --description "Print line counts" + complete -c shell:head -s c -l bytes --description "Print byte counts" + complete -c shell:head -a '__files' + + complete -c shell:tail -e + complete -c shell:tail -d "Displays last lines of file" + complete -c shell:tail -s q -l quiet --description "Suppress headers when printing multiple sources" + complete -c shell:tail -s f -l follow --description "Do not stop at end of file" + complete -c shell:tail -s F -l FOLLOW --description "Follow and check for file renaming or rotation" + complete -c shell:tail -s n -l lines --description "Number of lines to print" + complete -c shell:tail -s c -l bytes --description "Number of bytes to print" + complete -c shell:tail -a '__files' + + complete -c shell:date -e + complete -c shell:date -d "Display date and time" + complete -c shell:date -s u --description "Use UTC" + complete -c shell:date -s r --description "Print the date represented by 'seconds' since January 1, 1970" + complete -c shell:date -s v --description "Adjust date" + complete -c shell:date -s f --description "Use 'input_fmt' to parse 'new_date'" + + complete -c shell:wc -e + complete -c shell:wc -d "Word, line, character, and byte count" + complete -c shell:wc -s n -l lines --description "Print line count" + complete -c shell:wc -s c -l bytes --description "Print byte count" + complete -c shell:wc -s m -l chars --description "Print character count" + complete -c shell:wc -s w -l words --description "Print word count" + complete -c shell:wc -a '__files' + +} http://git-wip-us.apache.org/repos/asf/karaf/blob/257a994a/assemblies/features/base/src/main/resources/resources/etc/shell.init.script ---------------------------------------------------------------------- diff --git a/assemblies/features/base/src/main/resources/resources/etc/shell.init.script b/assemblies/features/base/src/main/resources/resources/etc/shell.init.script index a57cabc..85ef713 100644 --- a/assemblies/features/base/src/main/resources/resources/etc/shell.init.script +++ b/assemblies/features/base/src/main/resources/resources/etc/shell.init.script @@ -41,19 +41,24 @@ __load_class = { (($.reader class) classLoader) loadClass $1 } -# On 256 colors terminal, add a right prompt -max_colors = ($.jline.terminal getNumericCapability max_colors) -if { %(max_colors >= 256) } { - __rprompt_formatter = (((__load_class java.text.SimpleDateFormat) getConstructor (__load_class java.lang.String)) newInstance \'$'\u001B\[90m'\'HH:mm:ss) - __date_class = (__load_class java.util.Date) - \#rprompt = { $__rprompt_formatter format ($__date_class newInstance) } -} +// make sure that we catch exceptions +// as they do occur if the session is headless / non-interactive +jlineReader = $.reader +if { %(jlineReader != null) } { -setopt group -setopt auto-fresh-line -keymap "^[OA" up-line-or-search -keymap "^[[A" up-line-or-search -keymap "^[OB" down-line-or-search -keymap "^[[B" down-line-or-search + # On 256 colors terminal, add a right prompt + max_colors = ($.jline.terminal getNumericCapability max_colors) + if { %(max_colors >= 256) } { + __rprompt_formatter = (((__load_class java.text.SimpleDateFormat) getConstructor (__load_class java.lang.String)) newInstance \'$'\u001B\[90m'\'HH:mm:ss) + __date_class = (__load_class java.util.Date) + \#rprompt = { $__rprompt_formatter format ($__date_class newInstance) } + } + setopt group + setopt auto-fresh-line + keymap "^[OA" up-line-or-search + keymap "^[[A" up-line-or-search + keymap "^[OB" down-line-or-search + keymap "^[[B" down-line-or-search +}