[systemd-devel] [PATCH] systemctl: add edit verb

Ronny Chevalier chevalier.ronny at gmail.com
Mon Oct 13 16:06:42 PDT 2014


2014-10-13 16:13 GMT+02:00 Simon McVittie <simon.mcvittie at collabora.co.uk>:
> On 13/10/14 14:38, Dale R. Worley wrote:
>> My general understanding is that the traditional behavior when "you
>> need an editor but the user hasn't specified one" is to use "vi", and
>> so people who don't want "vi" *always* set $VISUAL in their
>> environment.
>
> The Right Thing™ is distro-specific. Debian and its derivatives have
> sensible-editor(1) which is a shell script that uses $VISUAL, $EDITOR,
> nano[1] or vi; I would expect systemd in Debian to use sensible-editor
> as its fallback, either via a configure option or a patch.
>
> In distros without sensible-editor, I'm tempted to say the solution is
> "stop being a distro without sensible-editor". New systemd API? :-)
>
Before I resend the patch, we should agree on what to do here, for me
it makes more sense to raise an error asking to set either EDITOR or
SYSTEMD_EDITOR than running vi or a "sensible-editor" like you said.
Because, someone used to its editor will quit vi or "sensible-editor"
and will try to find out how to set the editor for systemctl (Even if
it is well known for EDITOR or VISUAL, some people don't set these
variables).

If we raise an error, someone not used to these variables but having a
favorite editor will know how to change this. And if this person does
not have a favorite editor and never used one (unlikely but I think
this is the purpose of the sensible-editor ?), we can advice to set
EDITOR to nano or an equivalent.


More information about the systemd-devel mailing list