Skip to content

huntrar/cliquery

Repository files navigation

cliquery PyPI Version Total Downloads

a command-line browser interface

cliquery cuts down on clicking through command-line web searching, page previewing, and page bookmarking, among other features. An interactive prompt allows users to easily make successive queries and enter program flags dynamically; simply typing help will list all possible flags to enter. Opening a link will invoke a browser supplied by the user or detected automatically across Windows, OSX, and Linux platforms.

Installation

pip install cliquery --user

or

pip install git+https://github.com/huntrar/cliquery.git#egg=cliquery --user

or

git clone https://github.com/huntrar/cliquery
cd cliquery
python setup.py install --user

If you encounter issues installing lxml, see here.

It is advised to copy the blank .cliqrc into .local.cliqrc, as .cliqrc will be emptied after a program update. To do this, enter the following:

cd "$(dirname "$(cliquery -c)")" && cp .cliqrc .local.cliqrc

Recommended (optional) setup

Configuration setup is completely optional but will improve your experience. This includes integrating Google Custom Search, WolframAlpha, and/or selection of browser choice.

The browser invoked is selected implicitly by the webbrowser module. To explicitly choose your browser, set the name in .local.cliqrc under 'browser' or set the BROWSER environment variable on your system.

For best results, sign up for a Google Custom Search API key This defaults search to Google, otherwise results will come from Bing.

The instructions are as follows: Upon signing into Google, click on API Manager, then Credentials, and create an API key. Enter this under the 'google_api_key' field in .cliqrc.

Next, create a custom search engine. You must choose at least one site to search during creation (I chose stackoverflow.com), but to search the entire web you must click on this new search engine, go to Setup, then Basics, and select 'Search the entire web but emphasize included sites.' Then you may choose to keep or delete the site you originally provided.

After creating a custom search engine, click on the engine, go to Setup, and under Details click Search engine ID. Enter this under the 'google_engine_key' field.

For WolframAlpha usage, sign up for a WolframAlpha API key Enter your key under the 'wolfram_api_key' field.

Users may also import Firefox or Chrome bookmarks into .cliqrc by exporting the bookmarks to HTML and importing to cliquery with the -i flag. The imported bookmarks will be added to your existing bookmarks, which may result in duplicates.

Usage

usage: cliquery.py [-h] [-b] [-c] [-C] [-d] [-e] [-f] [-i [IMPORT]] [-o] [-p]
                   [-s] [-v] [-w]
                   [QUERY [QUERY ...]]

a command-line browser interface

positional arguments:
  QUERY                 keywords to search

optional arguments:
  -h, --help            show this help message and exit
  -b, --bookmark        view and modify bookmarks
  -c, --config          print config file location
  -C, --clear-cache     clear the cache
  -d, --describe        summarize links
  -e, --edit            edit config file
  -f, --first           open first link
  -i [IMPORT], --import [IMPORT]
                        import bookmarks from file
  -o, --open            directly open links
  -p, --print           print links to stdout
  -s, --search          search for links
  -v, --version         display current version
  -w, --wolfram         search WolframAlpha

Author

Notes

  • NOTE: If you receive the following message (or similar) when trying to modify bookmarks:

    IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/cliquery/.cliqrc'
    

    This means you did not follow the install advice and chose to install as root. You have three options:

    1. (recommended) Uninstall and reinstall as a non-root user by following the instructions above.
    2. Change the configuration file ownership from root to user by entering the following:
    
            sudo chown $USER "$(cliquery -c)"
    
    2. (not recommended) Execute cliquery as root, using su or sudo.
    
  • A search may return immediate results, such as calculations or facts made possible by WolframAlpha, or instead a page of Google search results comprised of links and their descriptions.

  • Interactive usage allows the user to continue making new queries by dynamically executing new program flags and/or queries. Entering h or help will list all possible prompt commands.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    1. Guido van Rossum - Official Site
    2. Images of python guido
    3. Guido van Rossum - Wikipedia, the free encyclopedia
    4. Guido van Rossum (@gvanrossum) | Twitter
    5. Guido van Rossum Wants to Bring Type Annotations to Python
    6. The Python Tutorial — Python 2.7.10 documentation
    7. Python (programming language) - Wikipedia, the free ...
    8. Van Rossum: Python is not too slow | InfoWorld
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    : d 1
    
    Guido's Personal Home Page     Guido van Rossum - Personal Home Page  "Gawky and proud of it."
    Dutch spelling rules dictate that when used in combination with myfirst name, "van" is not capitalized: "Guido van Rossum".
    But when mylast name is used alone to refer to me, it is capitalized, forexample: "As usual, Van Rossum was right."
    More Hyperlinks   Here's a collection of  essays  relating to Pythonthat I've written, including the foreword I wrote for Mark Lutz' book"Programming Python".
    The Audio File Formats FAQ  I was the original creator and maintainer of the Audio File FormatsFAQ.  It is now maintained by Chris Bagwellat  http://www.cnpbagwell.com/audio-faq .
    [Press Enter to continue..]
    
  • To choose multiple links at once, a range may be specified by separating the start and end range with a dash. Leaving one end of the range blank will choose all links until the other end of that range. For example, given 10 links, entering 5- would effectively be the same as entering 5-10.

  • Requests cache is enabled by default to cache webpages, it can be disabled by setting the environment variable CLIQ_DISABLE_CACHE.

  • Using the bookmark flag with no arguments will list all current bookmarks in .cliqrc, naturally ordered by time of entry. Entering help with the flag will list all possible commands including open, add, remove, tag/untag (for aliasing), describe, and move. Bookmarks like other flags may be entered during runtime in the link prompt.

  • Additional arguments may be appended to bookmarks while opening them. These are interpreted as any non-integer arguments which are not found in any bookmarks (URLs or tags).

About

a command-line browser interface

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages