Skip to content

Commit

Permalink
Replace --quiet with --banner (JuliaLang#23343)
Browse files Browse the repository at this point in the history
  • Loading branch information
HarrisonGrodin authored and JeffBezanson committed Aug 21, 2017
1 parent 7b1bf10 commit dcb46b3
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 20 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
==========================

Expand Down Expand Up @@ -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
10 changes: 5 additions & 5 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion base/options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions doc/man/julia.1
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ Run processes on hosts listed in <file>
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}
Expand Down
2 changes: 1 addition & 1 deletion doc/src/manual/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ julia [switches] -- [programfile] [args...]
--machinefile <file> Run processes on hosts listed in <file>
-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
Expand Down
23 changes: 17 additions & 6 deletions src/jloptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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[] = {
Expand All @@ -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' },
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions test/cmdlineargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`)

Expand Down
4 changes: 2 additions & 2 deletions test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit dcb46b3

Please sign in to comment.