This replicates behavior elsewhere, where we don't output anything if
there is no information to show. Instead, the "no accounts" message will
only show if the user supplies a -v / --verbose flag.
this adds a check for configured defaults during the command pre check
when authentication is required. using the values found if both are
present and only if both flags are ommitted.
now that the scheme is not required in the configuration file, we can
assume the configured value is correct. as with other uses, the
configured value is only used when noth host and user are present.
this updates newClient to prepend the scheme https to the default host
found in the global config, and only use said host when both the user
and host are configured
this uses the usersLoggedIn helper to check for already logged in users,
selecting the single user when only one present and returning and error
when multiple are logged in.
to start on a fix for user actions when logged in with one user on a
given host with the wf binary, a user should now only be loaded by the
caller of newClient.
newClient no longer takes a bool for authRequired, all calls
updated to new signature and load the user where required.
WriteFreely doesn't support non-auth'd posting like Write.as, so users
won't be creating non-auth'd posts with another client that they'd need
to add here.
Ref T586
Now when running `wf auth`, we'll automatically set the given host +
username as the default account in .writefreely/config.ini, so subsequent
requests without an explicit --host and --user will use this account.
Ref T635 T586
Unlike Write.as, WriteFreely doesn't support anonymous (unauthenticated)
publishing. With these changes, we reflect that in wf-cli by wrapping
creating, updating, and deleting posts in a func that checks
authentication state.
Ref T586
This automatically prepends https:// to any given --host value. It also
adds an --insecure flag, which will instead prepend http://
The goal with this is to save some typing and encourage operations over
HTTPS.
Ref T595