Permalink
Browse files

Change the way npm help works, so that it will work with man programs…

… that stubbornly refuse to take a troff file as an argument

That is, make it work on Solaris.
  • Loading branch information...
1 parent f9071cf commit dbee5c3b14f10fac8b15e661a8e5ed72d4e147c0 @isaacs isaacs committed Sep 21, 2010
View
19 Makefile
@@ -1,10 +1,10 @@
docs = $(shell find doc -name '*.md' \
|sed 's|.md|.1|g' \
- |sed 's|doc/|man/|g' \
+ |sed 's|doc/|man1/|g' \
)
doc_subfolders = $(shell find doc -type d \
- |sed 's|doc/|man/|g' \
+ |sed 's|doc/|man1/|g' \
)
install:
@@ -23,20 +23,23 @@ uninstall:
node cli.js cache clean
node cli.js rm npm
-man: $(doc_subfolders)
- @if ! test -d man ; then mkdir -p man ; fi
+man: man1
+ @true
+
+man1: $(doc_subfolders)
+ @if ! test -d man1 ; then mkdir -p man1 ; fi
-doc: man $(docs)
+doc: man1 $(docs)
@true
# use `npm install ronn` for this to work.
-man/%.1: doc/%.md
+man1/%.1: doc/%.md
ronn --roff $< > $@
-man/%/: doc/%/
+man1/%/: doc/%/
@if ! test -d $@ ; then mkdir -p $@ ; fi
test:
./test/run.sh
-.PHONY: install install-dev link doc clean uninstall test
+.PHONY: install install-dev link doc clean uninstall test man
View
9 lib/help.js
@@ -7,8 +7,13 @@ module.exports = help
function help (args, cb) {
var section = args.shift() || "help"
- fs.stat(path.join(__dirname, "../man/"+section+".1"), function (e, o) {
+ fs.stat(path.join(__dirname, "../man1/"+section+".1"), function (e, o) {
if (e) return cb(new Error("Help section not found: "+section))
- exec("man", [path.join(__dirname, "../man/"+section+".1")], cb)
+ // function exec (cmd, args, env, takeOver, cb) {
+ var manpath = path.join(__dirname, "..")
+ , env = {}
+ Object.keys(process.env).forEach(function (i) { env[i] = process.env[i] })
+ env.MANPATH = manpath
+ exec("man", [section], env, true, cb)
})
}
View
0 man/activate.1 → man1/activate.1
File renamed without changes.
View
0 man/adduser.1 → man1/adduser.1
File renamed without changes.
View
0 man/build.1 → man1/build.1
File renamed without changes.
View
0 man/bundle.1 → man1/bundle.1
File renamed without changes.
View
0 man/cache.1 → man1/cache.1
File renamed without changes.
View
0 man/coding-style.1 → man1/coding-style.1
File renamed without changes.
View
0 man/config.1 → man1/config.1
File renamed without changes.
View
0 man/deactivate.1 → man1/deactivate.1
File renamed without changes.
View
0 man/developers.1 → man1/developers.1
File renamed without changes.
View
0 man/folders.1 → man1/folders.1
File renamed without changes.
View
0 man/future-ideas/deploy.1 → man1/future-ideas/deploy.1
File renamed without changes.
View
0 man/future-ideas/remote.1 → man1/future-ideas/remote.1
File renamed without changes.
View
0 man/future-ideas/site.1 → man1/future-ideas/site.1
File renamed without changes.
View
0 man/help.1 → man1/help.1
File renamed without changes.
View
0 man/install.1 → man1/install.1
File renamed without changes.
View
0 man/json.1 → man1/json.1
File renamed without changes.
View
0 man/link.1 → man1/link.1
File renamed without changes.
View
0 man/list.1 → man1/list.1
File renamed without changes.
View
0 man/ln.1 → man1/ln.1
File renamed without changes.
View
0 man/ls.1 → man1/ls.1
File renamed without changes.
View
0 man/npm.1 → man1/npm.1
File renamed without changes.
View
0 man/owner.1 → man1/owner.1
File renamed without changes.
View
0 man/publish.1 → man1/publish.1
File renamed without changes.
View
0 man/rebuild.1 → man1/rebuild.1
File renamed without changes.
View
0 man/restart.1 → man1/restart.1
File renamed without changes.
View
0 man/rm.1 → man1/rm.1
File renamed without changes.
View
0 man/scripts.1 → man1/scripts.1
File renamed without changes.
View
0 man/start.1 → man1/start.1
File renamed without changes.
View
0 man/stop.1 → man1/stop.1
File renamed without changes.
View
0 man/tag.1 → man1/tag.1
File renamed without changes.
View
0 man/test.1 → man1/test.1
File renamed without changes.
View
0 man/uninstall.1 → man1/uninstall.1
File renamed without changes.
View
0 man/unpublish.1 → man1/unpublish.1
File renamed without changes.
View
0 man/update.1 → man1/update.1
File renamed without changes.
View
0 man/view.1 → man1/view.1
File renamed without changes.
View
2 package.json
@@ -27,7 +27,7 @@
{ "mail" : "npm-@googlegroups.com"
, "web" : "http://github.com/isaacs/npm/issues"
}
-, "directories" : { "doc" : "./doc", "man" : "./man", "lib" : "./lib" }
+, "directories" : { "doc" : "./doc", "man" : "./man1", "lib" : "./lib" }
, "bin" : { "npm" : "./cli.js" }
, "main" : "npm"
, "engines" : { "node" : ">=0.2.0" }

0 comments on commit dbee5c3

Please sign in to comment.