Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Workaround for issue #2 #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions bin/doco
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/env/node

// NOTE: You cannot (typically) run this file directly in Windows.
// For Windows, you may need to pass this file to node.exe
// See 'doco_win.bat' for scripting ideas for Windows.

var path = require("path"),
fs = require("fs"),
ascli = require("ascli"),
Expand All @@ -9,6 +13,10 @@ var path = require("path"),
argv = ascli.argv,
pkg = require("../package.json");

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

if (argv.length < 1) {
ascli.banner("doco".green.bold, pkg.version);
Expand Down
32 changes: 32 additions & 0 deletions doco_win.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

@echo off

REM Just a quick example of how one might use within Windows
REM ( There is another example at https://github.com/dcodeIO/doco/issues/1 )
REM You can use this info to create a BAT for your individual needs (or use as-is).

REM .\bin\doco cannot be run directly in Windows (it doesn't know #! lines)
REM .\bin\doco must be passed to node.exe directly

REM This BAT file example assumes:
REM 1. node.exe is available through the PATH
REM 2. This BAT is in the root of the doco module's folder
REM 3. You just want to do markdown on one file

echo Usage: "doco_win.bat Filename-without-ext"
echo (.js and .md added automatically to name for input and output)

if "%1"=="" goto blank

node %~dp0bin\doco --gen=markdown %1.js > %1.md
REM '%~dp0' is the path to this BAT file, '%1' is the first arg after bat file itself, '%*' would be all args
REM You could just pass all the arguments through using:
REM node %~dp0bin\doco %*
REM Or if you want to put a BAT in a folder where doco is installed as dependency
REM node %~dp0node_modules\doco\bin\doco %*
GOTO DONE

:BLANK
echo !! You must enter a file name (omitting .js) !!

:DONE