Code Monkey home page Code Monkey logo

cppman's Introduction

http://img.shields.io/pypi/v/cppman.svg?style=flat

cppman

C++ 98/11/14/17/20 manual pages for Linux, with source from cplusplus.com and cppreference.com.

https://raw.github.com/aitjcize/cppman/master/wiki/screenshot.png

Features

  • Supports two backends (switch it with cppman -s):
  • Syntax highlighting support for sections and example source code.
  • Usage/Interface similar to the 'man' command
  • Hyperlink between manpages (only available when pager=vim)
    • Press Ctrl-] when cursor is on keyword to go forward and Ctrl-T to go backward.
    • You can also double-click on keyword to go forward and right-click to go backward.
  • Frequently update to support cplusplus.com.

Demo

Using vim as pager

https://raw.github.com/aitjcize/cppman/master/wiki/demo.gif

Installation

  1. Install from PyPI:
$ pip install cppman

Note that cppman requires Python 3. Make sure that either pip is configured for Python 3 installation, your default Python interpreter is version 3 or just use pip3 instead.

  1. Arch Linux users can find it on AUR or using Trizen:
$ trizen -S cppman

or install the git version

$ trizen -S cppman-git
  1. Debian / Ubuntu: cppman is available in Debian sid/unstable and Ubuntu vivid.
$ sudo apt-get install cppman
  1. MacOS X: cppman is available in Homebrew and MacPorts.
$ brew install cppman

or

$ sudo port install cppman

Package Maintainers

FAQ

  • Q: Can I use the system man command instead of cppman?
  • A: Yes, just execute cppman -m true and all cached man pages are exposed to the system man command. Note: You may want to download all available man pages with cppman -c.
  • Q: Why is bash completion is not working properly with ::?
  • A: It is because bash treats : like a white space. To fix this add export COMP_WORDBREAKS=" /\"\'><;|&(" to your ~/.bashrc.

Bugs

  • Please report bugs / mis-formatted pages to the github issue tracker.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Notes

  • manpages-cpp is renamed to cppman since September 19, 2012

cppman's People

Contributors

aitjcize avatar belkka avatar bpfoley avatar cbsmith avatar chenrui333 avatar czchen avatar ddeka2910 avatar dssoto avatar eastonj avatar glenvt18 avatar grwn avatar jochenschneider avatar jwilk avatar ksr-yasuda avatar matan129 avatar meator avatar mmisono avatar pbsds avatar pseyfert avatar ram02z avatar rindeal avatar sgssgene avatar spiderpowa avatar superfunc avatar taiyu-len avatar z33ky avatar zopieux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cppman's Issues

[Suggestion] Windows support

Currently, cppman fails on Windows (I use MSYS2) with the following error:

Traceback (most recent call last):
  File "C:/msys64/mingw64/bin/cppman", line 40, in <module>
    from cppman.main import Cppman
  File "C:/msys64/mingw64/lib/python3.7/site-packages\cppman\main.py", line 36, in <module>
    from cppman import util
  File "C:/msys64/mingw64/lib/python3.7/site-packages\cppman\util.py", line 25, in <module>
    import fcntl
ModuleNotFoundError: No module named 'fcntl'

This answer on StackOverflow mentions a cross-platform module that could be used instead of fcntl, and could therefore make cppman compatible (or at least more compatible) with Windows (and by extension MSYS2).

can't open it

Traceback (most recent call last):
  File "/usr/local/bin/cppman", line 40, in <module>
    from cppman.main import Cppman
  File "/usr/local/lib/python2.7/dist-packages/cppman/main.py", line 33, in <module>
    import urllib.request
ImportError: No module named request

can you tell me how to solve this problem?
I try:

sudo pip install urllib
pip install urllib
sudo pip install request
pip install request

and when I try type"import urllib“and"inport request"in the python command Interpreter,the result is true.

Doesn't work with vim 7.4 on Debian 7.4

OS: Debian 7.4
Vim version: 7.4.444

%cppman std::vector
col: Invalid or incomplete multibyte or wide character
sed: couldn't write 568 items to stdout: Broken pipe

Vim: Reading from stdin...

Works alright when I change the pager to 'less'

cppman failed in python 3.3

cppman is not compatibility with python 3.3, there are two man issuses:

  1. print is function in python 3.3.
  2. except XXError, e: and except (XXError, YYError), e: should be change to except XXError as e: except (XXError, YYError) as e:

Doesn't work on OS X

If you try to run this on OS X, you get the error:

$ cppman vector
zcat: can't stat: /Users/mdkess/.local/share/man/cplusplus.com/std::vector.3.gz (/Users/mdkess/.local/share/man/cplusplus.com/std::vector.3.gz.Z): No such file or directory

The reason for this is that zcat on OS X doesn't support reading zip files. See here: http://serverfault.com/q/570024

The fix for this is to update the various pager_*.sh scripts in lib/ to use zcat < instead of just zcat, but I'm not sure of the compatibility of this with Linux.

`q` does not quit

Pressing q does not quit cppman as in man. Instead, the command :q!<CR> appears at the bottom of the screen. To quit, you must delete the <CR> part and press Enter. Tested with:

  • cppman 0.4.5
  • vim 7.4

Thanks for your attention.

C vs C++ man pages

I did the cppman -m true command to be able to use the man command to view c++ man pages. However, I noticed that some pages related to C have been replaced by the version coming from cplusplus.com

For example, the strtok "normal" man page is no longer available. With man strtok, I get the cplusplus.com version.

Is there a way to add only the man pages specific to C++, and keep the man pages of C functions as they were before ?

Pager issues on OS X

When trying to double click, or press enter, on a function name in the page. The following error message is displayed in the vim buffer.

Error Message:
error: [Errno 19] Operation not supported by device.

Relevant Software Versions:

  • usr/local/bin/cppman Ver 0.4.6
  • NVIM 0.1.1 (compiled Dec 27 2015 16:32:11)

Documents path

Now installation of documents goes right to share/doc/, but you need to create your separate folder for your documents, share/doc/cppman, I guess. At moment files COPYING, AUTHORS, README, ChangeLog are right in /usr/share/doc, but should be in /usr/share/doc/cppman (for example).

It could be fixed there.

update_mandb_path() and config.UpdateManPath

The function cppmap.util.update_mandb_path() is used only once in the code:

update_mandb_path()

# from bin/cppman:
        if config.UpdateManPath:  # bool variable
            update_mandb_path()

But the function itself checks the value of config.UpdateManPath and removes some strings from the file ~/.manpath when it is False

Something is wrong. We need either

  • Change the main program to enable this functionality
  • Remove all occurences of environ.config.UpdateManPath from the function assuming it always is True

Ubuntu/Debian packages

Users have been asking about Debian packages for cppman, however I'm no longer using Debian/Ubuntu anymore.

@czchen I noticed that you filed an debian RFS and ITP bug for cppman. I wonder if you are interested in helping cppman to maintain a PPA pacakge?

cppman is borken

manpages-cpp is currently broken due to the changes of cplusplus.com

Broken pages

stringstream
ostringstream
istreingstream

first table broken

second table member functions need to have newline char

How about `cache-all` respect user's selection of source

I want to discuss the cache-all feature. Current behavior is cache all sources that cppman supports, would it be better to respect user's current selection of sources by cppman -s?

Please let me know your thoughts, thanks.

error: can't copy 'README': doesn't exist or not a regular file

Because GitHub uses README.md for manual, so there will be an error message while setup.py install is running.

error: can't copy 'README': doesn't exist or not a regular file

This error will cause setup.py returns 1, then the automatic tools will abort.

So, please make a symbol link README to README.md, or change this line in setup.py:

- ['README', 'AUTHORS', 'COPYING', 'ChangeLog']
+ ['README.md', 'AUTHORS', 'COPYING', 'ChangeLog']

Code not displayed properly in strtok page

The line on the strtok manpage:

printf ("Splitting string \"%s\" into tokens:\n",str);

is displayed as

printf ("Splitting string

which also messes up the syntax highlighting.

vim with tmux question

The following suggestion from http://stackoverflow.com/a/30373736/5099723 doesn't do anything in console vim:

command! -nargs=+ Cppman silent! call system("tmux split-window cppman " . expand(<q-args>))
autocmd FileType cpp nnoremap <silent><buffer> K <Esc>:Cppman <cword><CR>

cppman and tmux are installed and working. keywordprg=cppman works but would be nice to split the window. Cheers

source cppreference.com broken

Hi, thanks for this awesome tool. I love it!
But I would like to use cppreference.com as a source (this work in the past).

Currently it doesn't work. (I tried the newest version from github).

$ ./bin/cppman -s cppreference.com
$ ./bin/cppman std::vector
error: bad escape \E at position 4

Thank you

UserWarning: No parser was explicitly specified

I've got a stock Python 3 installation (I think), and I get a BeautifulSoup warning:

~ » cppman vector::begin
/opt-local/lib/python3.3/site-packages/bs4/__init__.py:166: UserWarning: No parser was explicitly            specified,
so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a  problem,
but if you run this code on another system, or in a different virtual environment, it may use  a
different parser and behave differently.

To get rid of this warning, change this:

 BeautifulSoup([your markup])

to this:

 BeautifulSoup([your markup], "lxml")

  markup_type=markup_type))

Upgrading BeautifulSoup doesn't work:

~ » pip install --upgrade BeautifulSoup
Collecting BeautifulSoup
  Using cached BeautifulSoup-3.2.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-4ek1lu/BeautifulSoup/setup.py", line 22
        print "Unit tests have failed!"
                                      ^
    SyntaxError: invalid syntax

Vim plugin for using cppman

I wanted to use cppman from within an existing VIM instance rather than launching a new vim instance pager. Your existing script for the vim-pager provides most of the necessary parts, but some things had to be changed. I created a small plugin, heavily based on your script, for this purpose: https://github.com/gauteh/vim-cppman

It sets itself up whenver C++ or C files are opened so that keywordprg and iskeyword settings utilize cppman. The keywordprg sets up a new vert buffer which loads cppman in the same way as cppman.vim does.

Perhaps this should rather be included in cppman as a vim plugin? A few other modifications I had to make: use winwidth(0) rather than &co. Only load when for C++.

[Gentoo ebuild] python sqlite USE flag check missing

ebuild:
app-doc/cppman
Available versions: (~)0.4.6 {PYTHON_TARGETS="python3_3 python3_4"}
Installed versions: 0.4.6(11:43:37 AM 04/16/2016)(PYTHON_TARGETS="python3_4 -python3_3")

$ cppman vector
Traceback (most recent call last):
File "/usr/lib/python-exec/python3.4/cppman", line 40, in
from cppman.main import Cppman
File "/usr/lib64/python3.4/site-packages/cppman/main.py", line 32, in
import sqlite3
ImportError: No module named 'sqlite3'

temporary solution:
USE="sqlite" emerge dev-lang/python

Add support for FreeBSD

  1. The default program prefix of freebsd is /usr/local, not /usr, so I suggest that just ignore the "run in config dir" feature, and just search for both of these prefixes.
  2. FreeBSD has no mandb, and we dont need it.
  3. Seldom freebsd user install bash under /bin. Just use /usr/bin/env bash instead for viewer.sh
  4. add "set nonumber" for vim in viewer.sh pls.

pager.sh: 61: [: vim: unexpected operator

Hi, when using a recently installed cppman I am getting this error all the time:

~$ cppman string
/usr/local/lib/python3.4/dist-packages/cppman/lib/pager.sh: 61: [: vim: unexpected operator
Vim: Reading from stdin...

The lines 61 of that file is:

if [ "$pager_type" == "vim" ]; then

but I think it should be:

if [ "$pager_type" = "vim" ]; then

In fact, when removing the extra "=" that error disappears.

Cannot install in Fedora 19/ Linux mint 15

I've tried to install cppman in Fedora 19 or Linux mint 15 and it installs successfully.

pip install cppman -> succesfully installed

But when I try to use it I get the error:

cppman cout -> output is

Python IOError: [Errno 13] Permission denied

trying sudo will not help.

I've installed it in Ubuntu 12.04 and had no problem.

Empty pages opened in vim

  • New install using 'sudo pip install cppman'
  • cppman -v
    /usr/local/bin/cppman Ver 0.4.0 Copyright (C) 2010 Wei-Ning Huang License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
  • cppman std::vector

Result is an empty buffer open in vim.

  • Changed pager to less and system, same result.
  • Tried rebuilding index

Unable to use `man` to access cpp man pages

I ran cppman -c and then cppman -m true but man and apropos still cannot find any cpp man pages. I have verified that the man pages are indeed in my filesystem (i.e. the cppman -c command worked).

Question: another reference c++ website to crawl?

Hi,

I find your cppman very very useful, so congrat !

I know that the website which is crawled to obtain these manpages is http://www.cplusplus.com/reference/

I don't why but I often take some info on the Wiki http://en.cppreference.com/w/ website. It's not clear for me the difference between these two resources. Unless a few searches, I do not find anything.

I wonder why you decided to crawl cplusplus website for cppman: easier to crawl, more useful resources, ... ? Is there a chance to change the resource to cppreference to produce c++ manpages?

Let me know if you have more explanation about the difference about these two websites or even if you have a personal point of view.

Thanks,
Damien G.

Add classifiers to setup.py

Please add the right classifiers to setup.py. I would do it myself and open a PR but I have no idea what is the stability level or the exhaustive list of supported Python versions.

Given the Travis build, I suggest at least the following:

classifiers = (
    'Programming Language :: Python :: 2.6'
    'Programming Language :: Python :: 2.7',
    'Programming Language :: Python :: 2 :: Only',
)

Of course, if it is Python 3 compatible, some other should be added and 2 :: Only be removed.

Homebrew support

I'm not sure if this is the right place for this but I was hoping someone could add support for the Homebrew package manager. For example type 'brew install cppman' to install on a Mac. I would create the recipe myself but my attempt failed.

Vim: Reading from stdin...

If vim is used as the pager, cppman prints the following message to the terminal when a page is closed,

Vim: Reading from stdin...

This is an issue in vim that is related to piping content through stdin. There is a flag that can be used in v8.0+ of vim to prevent this text,

echo "foo" | vim - --not-a-term

But this will not work for users with an older version of vim, and I suspect there are a lot of people who are still using older versions.

There is a work-around that works for older versions,

echo "foo" | vim </dev/tty <(cat)

However, this does not work when invoked from within the python interpreter.

cppman fails to download some pages

2351 manual pages cahced successfully.
5 manual pages failed to cache.

ios
Input/Output
istream
ostream
iostream

Using ArchLinux and package from AUR.
Also fix spelling cahced -> cached ;)

A way to support cppman in Emacs

Hi,

I use Emacs so I am a bit curious that is there a way to integrate cppman into Emacs? I mean how can I query and use cppman just like linux man with a key map. Thx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.