-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Make it possible for fish_indent to read files. #3037
Comments
Makes sense to me. |
While I'm at it, gofmt has the following flag, which would be nice to have as well: |
Small modification of |
Seems reasonable to me as well and should be straightforward to implement without having to know C++ or fish internals. Want to take a stab at it @onodera-punpun? |
I wasn't aware that Too, this sort of thing really belongs in the binary rather than a wrapper script so that developers can |
The idea is that fish itself may want to invoke fish_indent, and this shouldn't require that fish live in $PATH to work. However it looks like there's only one builtin invocation of fish_indent (in As krader says, new options should live in the fish_indent binary, not the wrapper. |
I'll try editing the C++ file, I have a little bit of go and C knowledge, and it can't be that hard :) |
https://github.com/onodera-punpun/fish-shell/commit/4a49b8e5fb8eb77cdffc5790d61483f090f04160 So I'm pretty sure it can detect if it should read from stdin or argv now, however I'm not really sure /how/ to read from argv ( |
Use the
with something like the following (off the top of my head so may have bugs):
|
Diff: master...onodera-punpun:master So I think I'm almost done, however I'm struggling writing the actual formatted output to a file:
Oh, and it would be nice to to make the -w optarg optional if there if actually an input file, and write to that input file by defualt, is something like this possible? |
You need to convert it to a narrow C style string: You could write to the input file by closing it after you've read its contents then open it for writing. Perl has a |
I believe this has been resolved with the changes made by @onodera-punpun. |
Right now only something like
cat file | fish_indent
is possible, however being able tofish_indent ./file
would be nice (like howgofmt
does it)The text was updated successfully, but these errors were encountered: