Debian Codegraph @

demo/etc/gosh_profile

raw
1 # Load base profile
2 if { $.reader } {
3 source ((($.reader parser) class) getResource "/gosh_profile")
4 }
5
6 __load_class_from = {
7 (($1 class) classLoader) loadClass $2
8 }
9 __get_static_field = {
10 ((__load_class_from $.session $1) getField $2) get null
11 }
12 __call_static_method_no_arg = {
13 ((__load_class_from $.session $1) getMethod $2) invoke null
14 }
15 __new_candidate = {
16 new org.jline.reader.Candidate $1 $1 null $2 null null true
17 }
18
19 # Define the $.process variable
20 \#.process = {
21 __call_static_method_no_arg "org.apache.felix.service.command.Process\$Utils" "current"
22 }
23 # Define the $.job variable
24 \#.job = {
25 __call_static_method_no_arg "org.apache.felix.service.command.Job\$Utils" "current"
26 }
27
28 __process_stream = {
29 (($.job processes) get 0) $1
30 }
31
32 # with gogo-jline-1.0.4, should not be needed at all, see FELIX-5463 and FELIX-5462
33 (($.processor class) getMethod "addConverter" (__load_class_from $.processor "org.apache.felix.service.command.Converter")) invoke $.processor (new org.jline.demo.FunctionConverter)
34
35 if { $.terminal } {
36 try {
37 #
38 # TTop command
39 #
40 __ttop = {
41 _cl = (__load_class_from $.reader "org.jline.builtins.TTop")
42 $_cl "ttop" $.terminal (__process_stream "out") (__process_stream "err") ${argv[@]}
43 }
44 $.processor addcommand "gogo" $__ttop "ttop" 0
45
46 complete -c gogo:ttop -e
47 complete -c gogo:ttop -d "Display and update sorted information about threads"
48 complete -c gogo:ttop -s o -l order --description "Comma separated list of sorting keys"
49 complete -c gogo:ttop -s t -l stats --description "Comma separated list of stats to display"
50
51 max_colors = ($.terminal getNumericCapability "max_colors")
52 if { %(max_colors >= 256) } {
53 HIGHLIGHTER_COLORS = "rs=35:st=32:nu=32:co=32:va=36:vn=36:fu=1;38;5;69:bf=1;38;5;197:re=90"
54 } {
55 HIGHLIGHTER_COLORS = "rs=35:st=32:nu=32:co=32:va=36:vn=36:fu=94:bf=91:re=90"
56 }
57
58 __tmux_commands = [
59 (__new_candidate send-prefix "Send prefix")
60 (__new_candidate split-window "Split the current window")
61 (__new_candidate select-pane "Select pane")
62 (__new_candidate resize-pane "Resize pane")
63 (__new_candidate display-pane "Display panes")
64 (__new_candidate clock-mode "Clock mode")
65 (__new_candidate set-option "Set option")
66 (__new_candidate list-keys "List keys")
67 (__new_candidate send-keys "Send keys")
68 (__new_candidate bind-key "Bind key")
69 (__new_candidate unbind-key "Unbind key")
70 ]
71 complete -c gogo:tmux -e
72 complete -c gogo:tmux -d "Terminal multiplexer"
73 complete -c gogo:tmux -s h -l help --description "Display help and exit" -n '__option_not_present -h --help'
74 complete -c gogo:tmux -a 'wi = ($.commandLine wordIndex); if { %(wi==1) } { $__tmux_commands } { [ ] }'
75
76 __gogo = (new "org.jline.demo.Gogo" $.processor)
77 __remote_ssh_support = (new org.jline.builtins.ssh.Ssh \
78 ($__gogo shell) \
79 ($__gogo command) \
80 {
81 server = ((new org.apache.sshd.server.ServerBuilder) build)
82 $server setPasswordAuthenticator (__get_static_field org.apache.sshd.server.auth.password.AcceptAllPasswordAuthenticator INSTANCE)
83 $server setPublickeyAuthenticator (__get_static_field org.apache.sshd.server.auth.pubkey.AcceptAllPublickeyAuthenticator INSTANCE)
84 $server
85 } \
86 { (new org.apache.sshd.client.ClientBuilder) build } )
87 __remote_sshd = {
88 # See FELIX-5465, should be:
89 # a = [ "sshd" ${argv[@]} ]
90 a = [ "sshd" ]
91 each $argv { $a add $it }
92 $__remote_ssh_support sshd (__process_stream "out") (__process_stream "err") ${a[@]}
93 }
94 __remote_ssh = {
95 # See FELIX-5465, should be:
96 # a = [ "ssh" ${argv[@]} ]
97 a = [ "ssh" ]
98 each $argv { $a add $it }
99 $__remote_ssh_support ssh $.terminal $.reader $USER (__process_stream "in") (__process_stream "out") (__process_stream "err") ${a[@]}
100 }
101 $.processor addcommand "remote" $__remote_sshd "sshd" 0
102 $.processor addcommand "remote" $__remote_ssh "ssh" 0
103
104 complete -c remote:sshd -e
105 complete -c remote:sshd -d "SSH daemon"
106 complete -c remote:sshd -s i -l ip --description "Listening IP interface" -n '__option_not_present -i --ip'
107 complete -c remote:sshd -s p -l port --description "Listening IP port" -n '__option_not_present -p --port'
108 complete -c remote:sshd -a '[start stop status]'
109
110
111 complete -c remote:ssh -e
112 complete -c remote:ssh -d "SSH client"
113
114 __remote_telnet_support = (new org.jline.builtins.telnet.Telnet $.terminal ($__gogo telnet))
115 __remote_telnetd = {
116 a = [ "telnetd" ]
117 each $argv { $a add $it }
118 $__remote_telnet_support telnetd ${a[@]}
119 }
120 $.processor addcommand "remote" $__remote_telnetd "telnetd" 0
121
122 complete -c remote:telnetd -e
123 complete -c remote:telnetd -d "Telnet daemon"
124 complete -c remote:telnetd -s i -l ip --description "Listening IP interface" -n '__option_not_present -i --ip'
125 complete -c remote:telnetd -s p -l port --description "Listening IP port" -n '__option_not_present -p --port'
126 complete -c remote:telnetd -a '[start stop status]'
127
128 } {
129 if { not { (($exception cause) toString) startsWith "java.lang.NoClassDefFoundError: org/apache/sshd/" } } {
130 $exception printStackTrace
131 }
132 }
133
134 }