8000 Add option for transforming lots of files in-place · Issue #137 · lebab/lebab · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Add option for transforming lots of files in-place #137
Closed
@nene

Description

@nene

If you want to use Lebab in your project, you'll likely want to run it over more than just one file, in which case you'll need to resort to shell scripting. Doing something like the following:

for file in $(find . -name "*.js"); do
    lebab $file -o $file
done

Having this functionality built into Lebab is an often requested feature (e.g. see #114). Implementing it poses some challenges however:

  • Which files should we look for? Only *.js? What about *.jsx? Maybe we'll need an option for that.
  • Should we also look into hidden directories? Perhaps another option.
  • Should we also follow symlinks? Maybe yet another option.
  • Transforming lots of files could take time. Maybe we should log some feedback messages?

I think the important part is to make it easy to use Lebab for the most common use case (transforming a directory of *.js files). The special cases could be covered with external scripting like currently.

To keep lebab easily scriptable, the following should still work:

$ cat foo.js | lebab > out.js
$ lebab foo.js > out.js
$ lebab foo.js -o out.js

It also means, that this should not work:

$ lebab scripts/

Instead, there should be a separate option that would communicate the destructive nature of the operation:

$ lebab --replace scripts/
$ lebab --replace script.js
$ lebab --replace 'scripts/*.jsx'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0