Skip to content

Commit c82deaa

Browse files
CyDragon80CyDragon80
CyDragon80
authored and
CyDragon80
committed
Workaround for issue dcodeIO#2
1 parent e0800b1 commit c82deaa

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

bin/doco

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/usr/env/node
22

3+
// NOTE: You cannot (typically) run this file directly in Windows.
4+
// For Windows, you may need to pass this file to node.exe
5+
// See 'doco_win.bat' for scripting ideas for Windows.
6+
37
var path = require("path"),
48
fs = require("fs"),
59
ascli = require("ascli"),
@@ -9,6 +13,10 @@ var path = require("path"),
913
argv = ascli.argv,
1014
pkg = require("../package.json");
1115

16+
// Workaround issue based on luileito's report
17+
// https://github.com/dcodeIO/doco/issues/2
18+
if (opt == undefined) opt = app.opt;
19+
if (argv == undefined) argv = app.argv;
1220

1321
if (argv.length < 1) {
1422
ascli.banner("doco".green.bold, pkg.version);

doco_win.bat

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
@echo off
3+
4+
REM Just a quick example of how one might use within Windows
5+
REM ( There is another example at https://github.com/dcodeIO/doco/issues/1 )
6+
REM You can use this info to create a BAT for your individual needs (or use as-is).
7+
8+
REM .\bin\doco cannot be run directly in Windows (it doesn't know #! lines)
9+
REM .\bin\doco must be passed to node.exe directly
10+
11+
REM This BAT file example assumes:
12+
REM 1. node.exe is available through the PATH
13+
REM 2. This BAT is in the root of the doco module's folder
14+
REM 3. You just want to do markdown on one file
15+
16+
echo Usage: "doco_win.bat Filename-without-ext"
17+
echo (.js and .md added automatically to name for input and output)
18+
19+
if "%1"=="" goto blank
20+
21+
node %~dp0bin\doco --gen=markdown %1.js > %1.md
22+
REM '%~dp0' is the path to this BAT file, '%1' is the first arg after bat file itself, '%*' would be all args
23+
REM You could just pass all the arguments through using:
24+
REM node %~dp0bin\doco %*
25+
REM Or if you want to put a BAT in a folder where doco is installed as dependency
26+
REM node %~dp0node_modules\doco\bin\doco %*
27+
GOTO DONE
28+
29+
:BLANK
30+
echo !! You must enter a file name (omitting .js) !!
31+
32+
:DONE

0 commit comments

Comments
 (0)