diff --git a/NEWS.md b/NEWS.md index 1e3c1729e1659..49b16cd7741c5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -326,6 +326,8 @@ Command-line option changes * New option `--warn-overwrite={yes|no}` to control the warning for overwriting method definitions. The default is `no` ([#23002]). + * The `-q` and `--quiet` flags have been deprecated in favor of `--banner={yes|no}` ([#23342]). + Julia v0.6.0 Release Notes ========================== @@ -1182,3 +1184,4 @@ Command-line option changes [#23157]: https://github.com/JuliaLang/julia/issues/23157 [#23187]: https://github.com/JuliaLang/julia/issues/23187 [#23207]: https://github.com/JuliaLang/julia/issues/23207 +[#23342]: https://github.com/JuliaLang/julia/issues/23342 diff --git a/base/client.jl b/base/client.jl index c46d5acccc95c..0a6a51e0d1a99 100644 --- a/base/client.jl +++ b/base/client.jl @@ -253,7 +253,7 @@ function process_options(opts::JLOptions) repl = true startup = (opts.startupfile != 2) history_file = (opts.historyfile != 0) - quiet = (opts.quiet != 0) + banner = (opts.banner != 0) color_set = (opts.color != 0) global have_color = (opts.color == 1) global is_interactive = (opts.isinteractive != 0) @@ -317,7 +317,7 @@ function process_options(opts::JLOptions) break end repl |= is_interactive - return (quiet,repl,startup,color_set,history_file) + return (banner,repl,startup,color_set,history_file) end function load_juliarc() @@ -380,7 +380,7 @@ function _start() opts = JLOptions() @eval Main include(x) = $include(Main, x) try - (quiet,repl,startup,color_set,history_file) = process_options(opts) + (banner,repl,startup,color_set,history_file) = process_options(opts) local term global active_repl @@ -393,10 +393,10 @@ function _start() term = Terminals.TTYTerminal(get(ENV, "TERM", @static Sys.iswindows() ? "" : "dumb"), STDIN, STDOUT, STDERR) global is_interactive = true color_set || (global have_color = Terminals.hascolor(term)) - quiet || REPL.banner(term,term) + banner && REPL.banner(term,term) if term.term_type == "dumb" active_repl = REPL.BasicREPL(term) - quiet || warn("Terminal not fully functional") + banner && warn("Terminal not fully functional") else active_repl = REPL.LineEditREPL(term, true) active_repl.history_file = history_file diff --git a/base/deprecated.jl b/base/deprecated.jl index 97ec06ecb4484..b4dc3e0c509c2 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1687,6 +1687,9 @@ export hex2num # issue #5148, PR #23259 # warning for `const` on locals should be changed to an error in julia-syntax.scm +# issue #23342, PR #23343 +# `-q` and `--quiet` are deprecated in jloptions.c + # issue #17886 # deprecations for filter[!] with 2-arg functions are in associative.jl diff --git a/base/options.jl b/base/options.jl index 32530a17be183..7c9ffb8c01f37 100644 --- a/base/options.jl +++ b/base/options.jl @@ -2,7 +2,7 @@ # NOTE: This type needs to be kept in sync with jl_options in src/julia.h struct JLOptions - quiet::Int8 + banner::Int8 julia_home::Ptr{UInt8} julia_bin::Ptr{UInt8} eval::Ptr{UInt8} diff --git a/doc/man/julia.1 b/doc/man/julia.1 index b1f40f9dabc37..2944eca7f4436 100644 --- a/doc/man/julia.1 +++ b/doc/man/julia.1 @@ -108,8 +108,8 @@ Run processes on hosts listed in Interactive mode; REPL runs and isinteractive() is true .TP --q, --quiet -Quiet startup without banner +--banner={yes|no} +Enable or disable startup banner .TP --color={yes|no} diff --git a/doc/src/manual/getting-started.md b/doc/src/manual/getting-started.md index 42dee20115868..aaafc82a2b769 100644 --- a/doc/src/manual/getting-started.md +++ b/doc/src/manual/getting-started.md @@ -114,7 +114,7 @@ julia [switches] -- [programfile] [args...] --machinefile Run processes on hosts listed in -i Interactive mode; REPL runs and isinteractive() is true - -q, --quiet Quiet startup (no banner) + --banner={yes|no} Enable or disable startup banner --color={yes|no} Enable or disable color text --history-file={yes|no} Load or save history diff --git a/src/jloptions.c b/src/jloptions.c index 0d8e46dc24839..e91303e1e21de 100644 --- a/src/jloptions.c +++ b/src/jloptions.c @@ -33,7 +33,7 @@ JL_DLLEXPORT const char *jl_get_default_sysimg_path(void) } -jl_options_t jl_options = { 0, // quiet +jl_options_t jl_options = { 1, // banner NULL, // julia_home NULL, // julia_bin NULL, // eval @@ -102,7 +102,7 @@ static const char opts[] = // interactive options " -i Interactive mode; REPL runs and isinteractive() is true\n" - " -q, --quiet Quiet startup (no banner)\n" + " --banner={yes|no} Enable or disable startup banner\n" " --color={yes|no} Enable or disable color text\n" " --history-file={yes|no} Load or save history\n\n" @@ -170,7 +170,8 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp) opt_output_ji, opt_use_precompiled, opt_use_compilecache, - opt_incremental + opt_incremental, + opt_banner }; static const char* const shortopts = "+vhqH:e:E:L:J:C:ip:O:g:"; static const struct option longopts[] = { @@ -180,6 +181,7 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp) { "version", no_argument, 0, 'v' }, { "help", no_argument, 0, 'h' }, { "quiet", no_argument, 0, 'q' }, + { "banner", required_argument, 0, opt_banner }, { "home", required_argument, 0, 'H' }, { "eval", required_argument, 0, 'e' }, { "print", required_argument, 0, 'E' }, @@ -280,9 +282,6 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp) case 'h': // help jl_printf(JL_STDOUT, "%s%s", usage, opts); jl_exit(0); - case 'q': // quiet - jl_options.quiet = 1; - break; case 'g': // debug info if (optarg != NULL) { if (!strcmp(optarg,"0")) @@ -315,6 +314,18 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp) jl_options.image_file = strdup(optarg); jl_options.image_file_specified = 1; break; + case 'q': // quiet + jl_printf(JL_STDERR, "-q and --quiet are deprecated, use --banner=no instead\n"); + jl_options.banner = 0; + break; + case opt_banner: // banner + if (!strcmp(optarg,"yes")) + jl_options.banner = 1; + else if (!strcmp(optarg,"no")) + jl_options.banner = 0; + else + jl_errorf("julia: invalid argument to --banner={yes|no} (%s)", optarg); + break; case opt_use_precompiled: if (!strcmp(optarg,"yes")) jl_options.use_precompiled = JL_OPTIONS_USE_PRECOMPILED_YES; diff --git a/src/julia.h b/src/julia.h index 65ad583b02d45..cdf838287fb0a 100644 --- a/src/julia.h +++ b/src/julia.h @@ -1671,7 +1671,7 @@ JL_DLLEXPORT void jl_(void *jl_value); // julia options ----------------------------------------------------------- // NOTE: This struct needs to be kept in sync with JLOptions type in base/options.jl typedef struct { - int8_t quiet; + int8_t banner; const char *julia_home; const char *julia_bin; const char *eval; diff --git a/test/cmdlineargs.jl b/test/cmdlineargs.jl index 386504033579e..290365651521f 100644 --- a/test/cmdlineargs.jl +++ b/test/cmdlineargs.jl @@ -22,7 +22,7 @@ let exename = `$(Base.julia_cmd()) --precompiled=yes --startup-file=no` @test startswith(read(`$exename --help`, String), header) end - # --quiet + # --banner # This flag is indirectly tested in test/repl.jl # --home @@ -72,7 +72,7 @@ let exename = `$(Base.julia_cmd()) --precompiled=yes --startup-file=no` end # --procs - @test readchomp(`$exename -q -p 2 -e "println(nworkers())"`) == "2" + @test readchomp(`$exename --banner=no -p 2 -e "println(nworkers())"`) == "2" @test !success(`$exename -p 0`) @test !success(`$exename --procs=1.0`) diff --git a/test/repl.jl b/test/repl.jl index 8a1b07d3ea9f7..5b28c8ff6fda9 100644 --- a/test/repl.jl +++ b/test/repl.jl @@ -614,7 +614,7 @@ let exename = Base.julia_cmd() TestHelpers.with_fake_pty() do slave, master nENV = copy(ENV) nENV["TERM"] = "dumb" - p = spawn(setenv(`$exename --startup-file=no --quiet`,nENV),slave,slave,slave) + p = spawn(setenv(`$exename --startup-file=no --banner=no`,nENV),slave,slave,slave) output = readuntil(master,"julia> ") if ccall(:jl_running_on_valgrind,Cint,()) == 0 # If --trace-children=yes is passed to valgrind, we will get a @@ -631,7 +631,7 @@ let exename = Base.julia_cmd() end # Test stream mode - outs, ins, p = readandwrite(`$exename --startup-file=no --quiet`) + outs, ins, p = readandwrite(`$exename --startup-file=no --banner=no`) write(ins,"1\nquit()\n") @test read(outs, String) == "1\n" end # let exename