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

manly crashes if manpage is not english #31

Open
carlbordum opened this issue Nov 29, 2018 · 2 comments
Open

manly crashes if manpage is not english #31

carlbordum opened this issue Nov 29, 2018 · 2 comments

Comments

@carlbordum
Copy link
Owner

Issue #30 made me realise that manly only works on english man pages. Luckily it appears to only be the case, because of the regex here https://github.com/carlbordum/manly/blob/master/manly.py#L154 that parses the title/NAME.

Currently it crashes with the rather cryptic error

Traceback (most recent call last):
  File "manly.py", line 191, in <module>
    main()
  File "manly.py", line 180, in main
    title, output = manly(args.command)
  File "manly.py", line 151, in manly
    re.search(r"(?<=^NAME\n\s{5}).+", manpage, re.MULTILINE).group(0).strip()
AttributeError: 'NoneType' object has no attribute 'group'

All ideas welcome. What are the different approaches to handle this?

@Akuli
Copy link

Akuli commented May 18, 2020

One approach could be to tell man to output english (setting env var LANG=C works, but maybe some other env var might be the preferred way). Then the output of manly will also be in english, but I guess most people prefer to read tech related things in english anyway?

Another alternative would be to first read the man page in english to find the correct location in it, then display the corresponding part of the non-english man page.

@carlbordum
Copy link
Owner Author

I don't think we can count on translated man pages to have the same structure (either could have been reworked since the translation)

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

No branches or pull requests

2 participants