`[misc]`: Miscellaneous individual nailing-cargo config
-------------------------------------------------------
- * <a name="misc_online">`online`</a>: boolean, specifying whether to
- pass `--offline` to cargo (cargo's default is online mode). The
- default is offline, unless nailing-cargo can see that the cargo
- subcommand being invoked is one which requires online access, in
- which case the default is online.
+ * <a name="misc_online">`online`</a>:
+
+ Specifies whether to allow or prevent cargo from accessing the
+ network. Value is a boolean or `'auto'`. `'auto'` permits online
+ access if the cargo subcommand being invoked is one whose main
+ purpose involves online access.
+
+ Implemented by passing `--offline` to cargo when necessary ---
+ cargo's default is online. nailing-cargo's default is
+ `'auto'`.
Limitations and bugs
====================
sub addargs () {
$online = 1 if subcmd_p('online');
- $online //= cfg_bool qw(misc online);
+ if (!defined $online) {
+ $_ = cfg_uc qw(misc online);
+ if (!defined $_) {
+ } elsif (Types::Serialiser::is_bool $_) {
+ $online = $_;
+ } elsif (ref $_) {
+ } elsif (m/^a/) {
+ $online = undef;
+ } elsif (m/^[1ty]/) { # allow booleanish strings
+ $online = 1; # for less user frustration
+ } elsif (m/^[0fn]/) {
+ $online = 0;
+ } else {
+ badcfg qw(misc online), "expected boolean or 'auto', found '$_'";
+ }
+ }
+ $online //= cfg_bool
$online //= 0;
$cargo_lock_update //= subcmd_p('lock-update');