Commit graph

67 commits

Author SHA1 Message Date
Fabian Homborg
6e95e1d79d create_manpage_completions: Change "--save" to "--keep" 2020-04-04 15:30:09 +02:00
JanczarKnurek
f212aba174 Allow not to remove files from destination dir
Signed-off-by: JanczarKnurek <jacek@beit.tech>
2020-04-04 15:30:09 +02:00
Fabian Homborg
1406d63b85 Restyle
I kinda hate how fussy clang-format is. It reflows text
constantly (line limit), forces things onto one line *except* when
they're too long, and wants to turn this:

```c++
    return true;;
```

into this:

```c++
    return true;
    ;
```

instead of, you know, eliminating the second semicolon?

Anyway, it is what it is and we use it, I'll just look into getting some
more slack.
2020-03-26 20:45:40 +01:00
JanczarKnurek
e78ed51747 Add flag names to usage line
Signed-off-by: JanczarKnurek <jacek@beit.tech>
2020-03-24 21:04:29 +01:00
JanczarKnurek
b1c14cf084 Add missing flags desc to script
create_manpage_completions now has all flags in help

Signed-off-by: JanczarKnurek <jacek@beit.tech>
2020-03-24 21:04:29 +01:00
Fabian Homborg
c2970f9618 Reformat all files
This runs build_tools/style.fish, which runs clang-format on C++, fish_indent on fish and (new) black on python.

If anything is wrong with the formatting, we should fix the tools, but automated formatting is worth it.
2019-05-05 12:09:25 +02:00
Benjamin Nied
e7bfd1d71c Remove shebangs from py scripts
Starting with Fedora 30 and RHEL 8, ambiguous python shebangs will now
throw errors during the RPM build process instead of just warnings,
since these systems have moved to Python 3 by default, and Python 2 may
not be available in the future.

See [this
page](https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error)
for more details.

Drop these shebangs as the scripts are only ever called from fish
wrappers.
2019-01-06 20:39:04 +08:00
Aaron Bieber
db0ff0bcde Add generic parser for /etc/man.conf
- Also rename get_paths_from_manpath() to get_paths_from_man_locations()
2017-12-12 19:18:47 +01:00
Mahmoud Al-Qudsi
fa4cf77aff Ignore more invalid arguments from parsed man pages
Specifically closes #4313.
Not being as agressive in what we ignore/blacklist, but can be revisited
easily in the future to add more characters to the argument blacklist.
2017-08-14 18:18:09 -07:00
Mohamed Akram
d2d707a6fa Ignore comments when creating man page completion 2017-07-22 21:32:56 -07:00
Fabian Homborg
b3d5fb71f4 completion generator: Protect against undefined variable
Proc wasn't defined if $MANPATH was used.

Fixes #3808.
2017-02-03 18:32:14 +01:00
Fabian Homborg
94b71353ef completion generator: Define parent_paths directly if MANPATH is set 2017-02-03 18:32:14 +01:00
Fabian Homborg
03e0f1eb21 create_manpage_completions: Try more ways to get manpath
Haiku only has `man --path`.

Still doesn't support OpenBSD.

Use $MANPATH if available. This needs to:

- Ignore stderr (we pipe it and throw it away)

- Read the subprocess returncode, since `man --path` is an existing
  command that fails instead of a non-existent one (that raises an
  exception)

- Properly set up the fallback

Fixes #2194.
2017-01-29 18:00:48 -08:00
Kurtis Rader
f33ece11ac simplify invoking create_manpage_completions.py
My previous change to avoid creating a *.pyc file when running
create_manpage_completions.py was wrong because I put the
`sys.dont_write_bytecode = True` on the wrong line. Rather than simply
move that statement make the simpler, cleaner, fix that removes the need
for `eval` where that program is invoked.
2016-10-09 18:42:55 -07:00
Kurtis Rader
92e14d7e4a deal with Linux shebang handling
The Linux kernel only splits on the first whitespace in the shebang line
(unlike BSD which splits on all whitespace). Which means there can be
only one argument after the path to the program.
2016-10-09 15:09:44 -07:00
Kurtis Rader
213ef3ee56 don't produce *.pyc files
Producing man pages is done infrequently (basically just at `make test`
and `make install`) so there isn't any point in writing compiled
byte-code versions of the python modules.
2016-10-09 14:11:04 -07:00
Aaron Gyes
e75fc8452f Strip out brackets from generated-by-manpage completions.
Handles cases like cupsctl --\[no-\]remote-admin and
unxz --powerpc[ better.

Fixes #3272
2016-07-30 22:01:59 -07:00
Aaron Gyes
d895f876b4 Fix "UNINDENT ..." junk in manpage completions
Problem with Type2ManParser

before:
    complete -c xcode-select -s h -l help --description 'Prints the usage
message. UNINDENT NDENT 0. 0.'
after:
    complete -c xcode-select -s h -l help --description 'Prints the
usage message.'
2016-07-09 07:19:15 -07:00
Aaron Gyes
bb6ce9d142 minor create_manpage_completions.py improvements
Don't truncate long lines with " [See Man Page]" suffix - use the
reclaimed 15 characters for more-useful usage info.

Improve the --verbose output with:
 - spacing fixes
 - diagnostics related to input print repr()/quoted as %r to be less
   confusing.
 - get rid of stupid name() and use type()/__class__.__name__,

- Always use new-style (new as in post python 2.2) classes so this
  behaves the same whether we run in python 2 or 3.

- Properly convert left-quotes and right-quotes to that character in
  deroff.py
2016-07-09 05:51:32 -07:00
Andreas Wagner
3d19b549c8 Fix utf-8 decoding error in file_is_overwritable of create_manpage_completions.py 2016-05-29 14:12:32 -07:00
Vladimír Čunát
100eef4e42 docs: fix location of generated_completions (#3010) 2016-05-08 13:51:30 +02:00
Alexander Hedges
32d54e37f7 Use unused cleanup_autogenerated_file 2015-11-08 12:19:15 -08:00
Alexander Hedges
2bbad22248 Remove autogenerated files before generating the new ones
Currently if there is a conflict with two manpages having the same
name, one completion will override the other. But if one can be parsed
and the other can't the one with parsed results will always have a
higher priority.
2015-11-08 12:19:15 -08:00
Alexander Hedges
22493c9df8 Guard against files that don't end in .[1...9]
It seems smart to only let files be parsed that are clearly
manpage files. Other files wouldn't be openend by man so
I think it is safe to guess that only these files are man
pages.
2015-11-08 12:19:15 -08:00
Alexander Hedges
8d97a85834 Ignore references to builtin on the mac
On my system (OS-X 10.11) references to builtin are denoted by:
".so man1/builtin.1". So you also need to check against that.
2015-11-08 12:19:15 -08:00
Wonicon
4f3ff3d77f Correct the comment on the default path
According to the newer code below:
    xdg_data_home = os.getenv('XDG_DATA_HOME', '~/.local/share')
the actual default path is ~/.local/share/fish/generated_completions/
2015-09-26 15:23:45 +02:00
David Adam
a186f04f15 Manpage completions: store in $XDG_DATA_HOME
Closes #1343, works towards #1257.
2014-09-29 19:39:36 +08:00
Marc Joliet
fe3bca3a88 Prefer standard library lzma module if available
Prefer the standard library lzma module if available.  This change prevents
using the backports-lzma when it is installed for a version of Python that
already has the lzma module in its standard library.
2013-11-09 19:46:42 +08:00
Konrad Borowski
2a6eb83fb4 Merge pull request #1015 from marcecj/add_bz2_lzma_xz_support
Support bzip2 and lzma/xz compressed man pages
2013-10-18 05:09:00 -07:00
Marc Joliet
6de9a92582 Change the way xz/lzma man pages are detected
This avoids the use of the global and puts the diagnostic message in a
self-contained location.
2013-10-17 12:12:04 +02:00
Marc Joliet
1c8c9a10b5 Only print an error when an lzma/xz manpage occurs
Only print an error when an lzma/xz compressed man page occurs. Also, use
add_diagnostic instead of print.
2013-09-25 18:16:47 +02:00
Konrad Borowski
4aa9f76d06 Fix one element tuple to be actually tuple.
While in this case it doesn't mean much (neither `z` or `-` would be
passed to options parser), it makes things possibly less buggy.
2013-09-25 16:39:22 +02:00
Marc Joliet
fc7c489ab6 Skip lzma/xz manpages if lzma module not available
Skip man pages compressed with lzma/xz if the lzma module is not available; also
print a corresponding diagnostic message.
2013-09-25 15:41:48 +02:00
Marc Joliet
4856567a2a Only try "lzma" module on ImportError 2013-09-25 15:41:14 +02:00
Marc Joliet
7d0722bc18 Change an "if" to more appropriate "elif"
I overlooked an "if" that should have been an "elif". Oops.
2013-09-25 01:35:32 +02:00
Marc Joliet
4340368277 Support bzip2 and lzma/xz compressed man pages
Add support for bzip2 and lzma/xz compressed man pages.  Support for bzip2 is
part of the Python standard library (at least for 2.7 and >=3.2), while lzma/xz
is only in Python >=3.3; however, there is a backports module for Python 2.7 and
3.2.
2013-09-24 15:49:59 +02:00
bathtub
df300e042b Small fix for fish_update_completions (amended)
Amended from https://github.com/fish-shell/fish-shell/pull/1003.
Fix a Unicode parsing error; search man6.
2013-09-19 13:15:15 +02:00
Konrad Borowski
0479f0ad63 Remove useless debugging code 2013-07-27 17:08:06 +02:00
Siteshwar Vashisht
0fe44f0e2a Cleaned up commented lines and updated method names in create_manpage_completions script 2013-07-06 20:57:41 +05:30
Dag Odenhall
c06b1694a2 Parse man8 pages with fish_update_completions
Closes #727
2013-05-25 13:57:10 -07:00
ridiculousfish
2f5016262a Attempt again to fix UnicodeDecodeError (issue #658) 2013-05-12 01:57:42 -07:00
ridiculousfish
1c5556334d Try to fix UnicodeDecodeError in create_manpage_completions.py
https://github.com/fish-shell/fish-shell/issues/658
2013-04-15 01:05:56 -07:00
ridiculousfish
0e24676144 Fix to make create_manpage_completions work with Python 3
Fixes https://github.com/fish-shell/fish-shell/issues/658 ?
2013-04-14 02:03:53 -07:00
ridiculousfish
e7c1cb7185 Move autogenerated completions to ~/.config/fish/generated_completions/
https://github.com/fish-shell/fish-shell/issues/576
2013-02-17 16:14:36 -08:00
ridiculousfish
cddf7e0986 Clean up man page parser output a bit 2013-01-27 12:58:52 -08:00
ridiculousfish
de084b4a0d Make create_manpage_completions not generate empty files
https://github.com/fish-shell/fish-shell/issues/506
2013-01-08 14:58:27 -08:00
Jean-Daniel Dupas
43d2e15bb7 Try to fix create_manpage_completions script for system where sysgetdefaultencoding() returns ASCII. 2012-12-02 15:31:44 +01:00
ridiculousfish
be80e1a863 Improvements to man page parser, and to description truncation
Fixes https://github.com/fish-shell/fish-shell/issues/98
2012-11-22 20:32:19 -08:00
Łukasz Niemier
47df1ae40a Remove trailing whitespaces and change tabs to spaces 2012-11-18 11:23:22 +01:00
ridiculousfish
c7bf1aa222 Handle some more escapes in de-groffing man pages
Fixes https://github.com/fish-shell/fish-shell/issues/10
2012-10-17 18:22:57 -07:00