[Toybox] [PATCH] vi: rename `-s` flag to `-c`
enh
enh at google.com
Tue Jun 11 05:50:36 PDT 2024
On Tue, Jun 11, 2024 at 4:53 AM Rob Landley <rob at landley.net> wrote:
>
> On 6/7/24 03:41, Rob Landley wrote:
> > On 6/5/24 00:46, Jarno Mäkipää wrote:
> >> You cannot test against other vi clones with -c after this patch. But
> >> you could have test against vim with -s {script} implementation. I
> >> used vim as reference for testing with original test case files.
> >
> > If I'm cloning bash specifically for toysh, I don't have an objection to
> > targeting vim specifically in a toybox vi implementation.
> >
> >> Ex command only switch -c could be added as addition to -s if you
> >> wanna achieve something with ex commands, but maybe dont delete -s
> >> implementation, unless you have better way to test vi mode motions.
> >
> > Right now the regression test contexts I'm paying attention to are busybox
> > defconfig and debian's default install. How does this impact testing against those?
>
> Looking further at this, what is the behavioral difference between -c and -s?
> The patch does nothing but change one into the other, with no other behavior
> change I've spotted?
>
> The vim man page says:
>
> -c {command}
> {command} will be executed after the first file has been
> read. {command} is interpreted as an Ex command. If the
> {command} contains spaces it must be enclosed in double
> quotes (this depends on the shell that is used). Example:
> Vim "+set si" main.c
> Note: You can use up to 10 "+" or "-c" commands.
>
> -s {scriptin}
> The script file {scriptin} is read. The characters in the
> file are interpreted as if you had typed them. The same
> can be done with the command ":source! {scriptin}". If the
> end of the file is reached before the editor exits, further
> characters are read from the keyboard.
>
> I thought for a moment that -c was jumping straight into esc-colon mode with the
> command line at the bottom of the screen, but the -c example above does not
> provide -c on the command line and I am just CONFUSED.
>
> Jarno: what "other clones" were you referring to? Posix has -c, and does not
> have -s. Are we supporting non-posix clones other than vim? (Is there a default
> freebsd or macos version that ignores posix, maybe?)
(macOS' vi is vim.)
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/vi.html
>
> I do not have the domain expertise to understand the objection here.
i think the objection is quite simple, no? -c takes a _command_
whereas -s takes a _filename_ (and that file is full of commands).
what's currently implemented _is_ -s, and it would be wrong to rename
it to -c.
as if that's not enough, -s takes _normal mode_ commands, but -c takes
_ex mode_ commands.
they could hardly be more different if they tried :-)
> > Rob
>
> Still Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
More information about the Toybox
mailing list