Code Monkey home page Code Monkey logo

manpm's Introduction

manpm

Shows the relevant part of NPM module's README file right in your terminal

NPM

manpm alternate CI semantic-release npm checklist CHECKLIST.md

Badge

If you module has API well-described in the README, and manpm <text> works well, consider adding the following manpm compatible badge to your README. Here is the markdown for both variants: words or unicode symbols

[![manpm](https://img.shields.io/badge/manpm-compatible-3399ff.svg)](https://github.com/bahmutov/manpm)
[![alternate](https://img.shields.io/badge/manpm-%E2%9C%93-3399ff.svg)](https://github.com/bahmutov/manpm)

Install

npm install -g manpm

Show the entire README from a package or github repo

You can give NPM package name (like manpm), GitHub user / repo pair (like bahmutov/manpm) or full GitHub url (like https://github.com/bahmutov/object-fitter or [email protected]:bahmutov/object-fitter.git).

manpm <package name | github repo>

For example manpm email-regex will render the README from email-regex package in you terminal

manpm screenshot

Show part of the readme

manpm <package name> [optional search text inside README]

If search text is provided, only a section of the README file with that text (if found) will be displayed.

manpm search section

The following search features are implemented

  • find exact match in the section heading text
  • fuzzy text match in the section heading text
  • find exact match in the section body
  • fuzzy text match in the section body

I am still looking for a library capable of fuzzy text search. Maybe lunr?

Show and search local README

Sometimes you just want to find a section in the local README file, right in the current directory.

manpm . [optional search text]

Example: showing ES6 docs

There is a great GitHub repo ES6 Overview in 350 Bullet Points hosted at https://github.com/bevacqua/es6. Let us see how we can info for WeakSets

$ manpm bevacqua/es6 weaksets
# WeakSets

    * WeakSet is sort of a cross-breed between Set and WeakMap
    * A WeakSet is a set that can't be iterated and doesn't have enumeration methods
    * WeakSet values must be reference types
    * WeakSet may be useful for a metadata table indicating whether a reference is actively in use or not
    * Read ES6 WeakSets in Depth (https://ponyfoo.com/articles/es6-weakmaps-sets-and-weaksets-in-depth#es6-weaksets)

<sup>(back to table of contents) (#table-of-contents)</sup>

I added an alias to manpm bevacqua/es6 command to my shell alias file for convenience

$ echo 'alias es6-docs="manpm bevacqua/es6"' >> ~/.alias
source ~/.alias
es6-docs weaksets
es6-docs array

Example: showing ES6 features

Another great succint overview of ES6 features is in lukehoban/es6features. Let us add an alias

echo 'alias es6-features="manpm lukehoban/es6features"' >> ~/.alias
source ~/.alias

Let us look up the binary notation in ES6

es6-features binary
### Binary and Octal Literals
Two new numeric literal forms are added for binary (b) and octal (o).
    0b111110111 === 503 // true
    0o767 === 503 // true

Pipe through less | more

You can pipe the output of manpm through "less" or "more" tools - but you will lose the Markdown highlighting.

manpm <package name> | less
manpm <package name> | more

Advanced

If there are problems and manpm is not working as expected, you can see the debug output. Just run the tool with DEBUG=manpm manpm ... environment setting.

$ DEBUG=manpm manpm object-fitter
manpm fetching README for package +0ms object-fitter

Good testing commands:

DEBUG=manpm npm run example-es6-docs

Inspired by the following tools

I wanted something a little more API friendly, like finding and showing a README section that talked about a specific API method for example.

More examples

Small print

Author: Gleb Bahmutov © 2015

License: MIT - do anything with the code, but don't blame me if it does not work.

Spread the word: tweet, star on github, etc.

Support: if you find any problems with this module, email / tweet / open issue on Github

MIT License

Copyright (c) 2015 Gleb Bahmutov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

manpm's People

Contributors

bahmutov 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

Watchers

 avatar  avatar  avatar

manpm's Issues

'shasum check failed' on installation

Hey there, I just wanted to give manpm a try and it fails in several npm and node version in the installation process.

stefan @ stefan-mac: ~/Sites/electron-build-demo master (╯°□°)╯
> npm install -g manpm                                                                    [14:25:07]
npm ERR! Darwin 15.0.0
npm ERR! argv "/Users/stefan/.nvm/v5.0.0/bin/node" "/Users/stefan/.nvm/v5.0.0/bin/npm" "install" "-g" "manpm"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.6

npm ERR! shasum check failed for /var/folders/03/cgg2bwfd6j92tfllylt5b91m0000gn/T/npm-81868-930781f3/registry.npmjs.org/manpm/-/manpm-1.3.0.tgz
npm ERR! Expected: 3f055d6e700df08338d821b9793d527b3f0641c7
npm ERR! Actual:   afc36a15f9ffd57ef168823207494e4574ff4326
npm ERR! From:     https://registry.npmjs.org/manpm/-/manpm-1.3.0.tgz
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/stefan/Sites/electron-build-demo/npm-debug.log

FAIL: 1

Installing other packages globally works fine.

Do you maybe have an idea what going on here?

Crashes on Node 5.4

Seems problem with bluebird Promisify

var Promise = require('bluebird');
var getReadmeFile = Promise.promisify(require('get-package-readme'));
TypeError: Promise.promisify is not a function

could also be related to using really-need?

Problem with check-more-types

$ manpm check-more-types defend
{ [Error: check-more-types: package.json has no readmeFilename]
  cause: [Error: check-more-types: package.json has no readmeFilename],
  isOperational: true }

Invalid dependency name

npm install -g manpm
npm ERR! unpack Could not read data for @bahmutov/[email protected]
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/iojs" "/usr/local/bin/npm" "install" "-g" "manpm"
npm ERR! node v4.3.0
npm ERR! npm  v2.14.12

npm ERR! Invalid name: "@bahmutov/parse-github-repo-url"

Add manpm-compatible badge

Something to tell people that the readme is good enough to search against.



the badge should have url back to this projet

How to make compatible with less

When trying to pipe manpm <package name> | less it starts displaying the color / control characters. Should not. Can we add pagination?

Problem running against package hr

gives the following output

$ DEBUG=manpm manpm hr
  manpm fetching README for package +0ms hr
{ [Error: hr: cannot parse repository url]

problem npm 2.10 node 0.12

ip-10-1-10-144:~ bfaviero$ manpm k2
module.js:338
    throw err;
          ^
Error: Cannot find module 'github-url-to-object'
    at Function.Module._resolveFilename (module.js:336:15)
    at Module.reallyNeedRequire [as require] (/usr/local/lib/node_modules/manpm/node_modules/really-need/index.js:84:27)
    at Object.<anonymous> (/usr/local/lib/node_modules/manpm/src/get-readme.js:11:1)

Problem running manpm with Node.js v5.2.0 under nvm

Problem running manpm with Node v5.2.0 version, when using nvm for managing Node.js versions.

Originally installed with:

$ npm install -g manpm
/home/d2s/.nvm/versions/node/v5.2.0/bin/manpm -> /home/d2s/.nvm/versions/node/v5.2.0/lib/node_modules/manpm/bin/manpm.js
/home/d2s/.nvm/versions/node/v5.2.0/lib

When running the software, manpm fails to find Node executable.

$ manpm bevacqua/es6 weaksets
/usr/bin/env: node --harmony: No such file or directory

Enviroment variables include path to Node.js binary folder.

$ /usr/bin/env | grep node
NVM_BIN=/home/d2s/.nvm/versions/node/v5.2.0/bin
NVM_PATH=/home/d2s/.nvm/versions/node/v5.2.0/lib/node
…

Directory has the node binary file:

$ ll /home/d2s/.nvm/versions/node/v5.2.0/bin/node 
-rwxrwxr-x 1 d2s d2s 24M joulu  9 06:06 /home/d2s/.nvm/versions/node/v5.2.0/bin/node

Not really sure how this should be fixed, but the problem is probably caused by the line in manpm.js file:

#!/usr/bin/env node --harmony

(Ubuntu, with zsh shell as the default console environment.)

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.