From a1c3f33f393b671b846a40af6538a1887b8ed13b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 30 Sep 2013 05:48:09 +0200 Subject: separate username reading and logging in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- got | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'got') diff --git a/got b/got index 72655a4..eadbe86 100755 --- a/got +++ b/got @@ -24,12 +24,25 @@ if [ "$1" = "-" ]; then export "$@" - login_function=_login display_function=_display + read_function=_read + login_function=_login - function _login + function _display + { + echo -en '\e[H\e[2J' + echo -e "\e[${ANSI_COLOR}m${NAME} (${tty})\e[00m" + echo + echo -n 'Login: ' + } + + function _read { read user + } + + function _login + { if [ ! "${user/@/}" = "${user}" ]; then export GOT_COMMAND="@ssh@ ${user}" login -p -f @sshlogin@ @@ -42,14 +55,6 @@ if [ "$1" = "-" ]; then fi } - function _display - { - echo -en '\e[H\e[2J' - echo -e "\e[${ANSI_COLOR}m${NAME} (${tty})\e[00m" - echo - echo -n 'Login: ' - } - NAME="$(uname -o)" ANSI_COLOR='01;34' # must be exactly ANSI_COLOR as it is defined in /etc/os-release if [ -f "@etc@/os-release" ]; then @@ -60,6 +65,7 @@ if [ "$1" = "-" ]; then fi $display_function + $read_function $login_function else # cannot get any other solution to work with `login` -- cgit v1.2.3-70-g09d2