repl: reduce the vertical size used by V's logo, put it on the left of the info texts (#13451)

pull/13460/head
igor 2022-02-13 11:41:36 +02:00 committed by GitHub
parent bad30bdd79
commit 9ff0c51e61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 19 deletions

View File

@ -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) {

View File

@ -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)