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

STDIN an local Setting not working #189

Closed
sv-dl opened this issue Mar 21, 2020 · 3 comments
Closed

STDIN an local Setting not working #189

sv-dl opened this issue Mar 21, 2020 · 3 comments

Comments

@sv-dl
Copy link

@sv-dl sv-dl commented Mar 21, 2020

Hallo,

I'm trying to use latexindent as a filter and find out that this will not work with using local setting files like
cat doc.tex | latexindent.pl -l myConf.yaml
Trys to fomat myConf.yaml instead of doc.tex

I've found the reason in latexindent.pl well documente

# check local settings doesn't interfer with reading the file;
# this can happen if the script is called as follows:
#
#       latexindent.pl -l myfile.tex
#
# in which case, the GetOptions routine mistakes myfile.tex
# as the optional parameter to the l flag.
#
# In such circumstances, we correct the mistake by assuming that 
# the only argument is the file to be indented, and place it in @ARGV
if($switches{readLocalSettings} and scalar(@ARGV) < 1) {
    push(@ARGV,$switches{readLocalSettings});
    $switches{readLocalSettings} = ''; 
}

I'm not really sure what's the right way to handle the problem. Maybe there should be a extra option to tell latexindent.pl that I really want to read from STDIN or test if there is something to read from STDIN or check if the file after -l has an extension and is a yaml-file.

Thanks for this nice tool
regards
sv-dl

@sv-dl

This comment has been minimized.

Copy link
Author

@sv-dl sv-dl commented Mar 21, 2020

a work around is specifying - as document like

cat doc.tex | latexindent.pl -l myConf.yaml -

@cmhughes

This comment has been minimized.

Copy link
Owner

@cmhughes cmhughes commented Mar 21, 2020

Thanks very much for this, and also for the work around -- I very much appreciate you debugging this! I think that your work around is the appropriate way to handle this.

I admit that I hadn't come across this issue before, as I hadn't thought of it! I've updated the documentation to detail this, as it wasn't explicitly detailed previously.

Thank you!

@cmhughes

This comment has been minimized.

Copy link
Owner

@cmhughes cmhughes commented Mar 21, 2020

Implemented in Version 3.8, #190

@cmhughes cmhughes closed this Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.