Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find not fully supported #177

Open
tdjastrzebski opened this issue Mar 26, 2020 · 7 comments
Open

find not fully supported #177

tdjastrzebski opened this issue Mar 26, 2020 · 7 comments
Labels

Comments

@tdjastrzebski
Copy link

I just made the first attempt to use shx.
shx find BUILD/debug -type f -name '*.o'
yields find: no such file or directory: -type

@nfischer
Copy link
Member

This is a known limitation of ShellJS's find() method. First step would be supporting the -type flag over there. I think shx could translate "-name" to shelljs's expected syntax, similar to how we translate sed's syntax:

shx/src/shx.js

Lines 95 to 100 in 7e7bf7f

// Workaround for sed syntax
let ret;
if (fnName === 'sed') {
const newArgs = convertSedRegex(args);
ret = shell[fnName].apply(input, newArgs);
} else {

@nfischer nfischer added the feat label Mar 27, 2020
@tdjastrzebski
Copy link
Author

It looks -name flag is not fully supported as well.
shx find BUILD/debug -name '*.o'
results in find: no such file or directory: -name

@nfischer
Copy link
Member

nfischer commented Mar 30, 2020

-name is just the default argument. Try cd BUILD/debug && shx find '**/*.o'.

@tdjastrzebski
Copy link
Author

Well, yes, of course. The point, however, is still valid. -name flag is not supported.

@nfischer
Copy link
Member

My point above was that we could probably translate that within shx itself (merge default arg + -name into shelljs's expected input). But there's little point for doing so right now because shell.find() is just a wrapper around shell.ls() (you could just use shx ls for the same effect). If we implement -type, then shell.find() would bring something valuable to the table.

@carlocorradini
Copy link

Any update on this? Thanks 😥

@carlocorradini
Copy link

carlocorradini commented Feb 9, 2023

Sorry for bothering you, but does the following work?

npx shx find "scripts/**/*.sh" -exec npx shellcheck {} \;

Or there is another (supported) approach? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants