From 9ff0c51e611df3b53a14e2a43232d263d77bfe76 Mon Sep 17 00:00:00 2001 From: igor <40393850+ZaViBiS@users.noreply.github.com> Date: Sun, 13 Feb 2022 11:41:36 +0200 Subject: [PATCH] repl: reduce the vertical size used by V's logo, put it on the left of the info texts (#13451) --- cmd/tools/vrepl.v | 30 ++++++++++++++++++++---------- cmd/v/v.v | 10 +--------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/cmd/tools/vrepl.v b/cmd/tools/vrepl.v index 73809490ea..cfa177a7a1 100644 --- a/cmd/tools/vrepl.v +++ b/cmd/tools/vrepl.v @@ -207,16 +207,26 @@ fn (mut r Repl) parse_import(line string) { } fn print_welcome_screen() { - println(version.full_v_version(false)) - println('Use Ctrl-C or ${term.highlight_command('exit')} to exit, or ${term.highlight_command('help')} to see other available commands') - println(r' - ____ ____ - \ \ / / - \ \/ / - \ / - \ / - \__/ - ') + cmd_exit := term.highlight_command('exit') + cmd_help := term.highlight_command('v help') + file_main := term.highlight_command('main.v') + cmd_run := term.highlight_command('v run main.v') + vbar := term.bright_green('|') + vlogo := [ + term.bright_blue(r' ____ ____ '), + term.bright_blue(r' \ \ / / '), + term.bright_blue(r' \ \/ / '), + term.bright_blue(r' \ / '), + term.bright_blue(r' \ / '), + term.bright_blue(r' \__/ '), + ] + eprintln('${vlogo[0]}') + eprintln('${vlogo[1]} $vbar Welcome to the V REPL (for help with V itself, type $cmd_exit, then run $cmd_help).') + eprintln('${vlogo[2]} $vbar NB: the REPL is highly experimental. For best V experience, use a text editor,') + eprintln('${vlogo[3]} $vbar save your code in a $file_main file and execute: $cmd_run') + eprintln('${vlogo[4]} $vbar ${version.full_v_version(false)}') + eprintln('${vlogo[5]} $vbar Use Ctrl-C or ${term.highlight_command('exit')} to exit, or ${term.highlight_command('help')} to see other available commands') + eprintln('') } fn run_repl(workdir string, vrepl_prefix string) { diff --git a/cmd/v/v.v b/cmd/v/v.v index 60ab87b248..998d9dddd9 100644 --- a/cmd/v/v.v +++ b/cmd/v/v.v @@ -65,15 +65,7 @@ fn main() { if args.len == 0 || args[0] in ['-', 'repl'] { if args.len == 0 { // Running `./v` without args launches repl - if os.is_atty(0) != 0 { - cmd_exit := term.highlight_command('exit') - cmd_help := term.highlight_command('v help') - file_main := term.highlight_command('main.v') - cmd_run := term.highlight_command('v run main.v') - println('Welcome to the V REPL (for help with V itself, type $cmd_exit, then run $cmd_help).') - eprintln(' NB: the REPL is highly experimental. For best V experience, use a text editor,') - eprintln(' save your code in a $file_main file and execute: $cmd_run') - } else { + if os.is_atty(0) == 0 { mut args_and_flags := util.join_env_vflags_and_os_args()[1..].clone() args_and_flags << ['run', '-'] pref.parse_args_and_show_errors(external_tools, args_and_flags, true)