[prev in list] [next in list] [prev in thread] [next in thread] 

List:       musl
Subject:    Re: [musl] [PATCH 1/2] tools: Add a script to remove trailing spaces
From:       Jules Maselbas <jmaselbas () kalray ! eu>
Date:       2022-05-04 8:20:40
Message-ID: 20220504082040.GA10082 () tellis ! lin ! mbt ! kalray ! eu
[Download RAW message or body]

Hi Patrick,

On Wed, May 04, 2022 at 04:06:44PM +1000, Patrick Oppenlander wrote:
> On Wed, May 4, 2022 at 1:57 AM Jules Maselbas <jmaselbas@kalray.eu> wrote:
> >
> > Add the remove-trailing-space.sh script, it will only consider files
> > tracked by git. Optionaly accept arguments to select the affected path.
> >
> > Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
> > ---
> >  tools/remove-trailing-space.sh | 2 ++
> >  1 file changed, 2 insertions(+)
> >  create mode 100755 tools/remove-trailing-space.sh
> >
> > diff --git a/tools/remove-trailing-space.sh b/tools/remove-trailing-space.sh
> > new file mode 100755
> > index 00000000..a8b0056a
> > --- /dev/null
> > +++ b/tools/remove-trailing-space.sh
> > @@ -0,0 +1,2 @@
> > +#!/bin/sh
> > +git grep  '[[:space:]]$' -- $@ | sed 's/:.*//' | uniq | xargs sed -i 's/[[:space:]]\+$//'
> 
> There's a --name-only option you can give to git grep, so I think you
> can simplify this to:
Thanks, I've looked for this kind of option but failed to found it :)

> git grep --name-only '[[:space:]]$' | xargs sed -i 's/[[:space:]]\+$//'
This is much better :)

> Patrick
> 
> 




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic