Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
loicortola committed Feb 28, 2016
1 parent 8aefa83 commit 1f18abb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ In this Example, the baudrate is changed to 19.2k and COM3 is selected as defaul
"baudrate": "19200",
"port": "COM3",
"compile": true,
"optimize": true
"optimize": true,
"keeppath": true
}
```

Expand All @@ -149,6 +150,7 @@ All configuration options are **optional**
* **port** (string) - the comport to use
* **compile** (boolean) - compile lua files after upload
* **optimize** (boolean) - optimize files before uploading
* **keeppath** (boolean) - keep the relative file path in the destination filename (i.e: static/test.html will be named static/test.html)


### Notes ###
Expand Down Expand Up @@ -211,7 +213,9 @@ The most important task of this tool: upload local files to the module.
**Options**

* `--optimize` | Remove Comments, Whitespaces and empty lines from the file before upload
* `--compile` | Compiles the uploaded .lua file into executable bytecode and removes the source .lua file (performance)
* `--compile` | Compiles the uploaded .lua file into executable bytecode and removes the source .lua file (performance)
* `--keeppath` | Keeps the relative file path in the destination filename (i.e: static/test.html will be named static/test.html)
* `--remotename` | Set the destination file name

**Example 1**

Expand Down Expand Up @@ -244,6 +248,27 @@ Upload a text file.
$ nodemcu-tool upload HelloWorld.txt
```

**Example 4**

Upload a static file and keep its relative path as remote name.

```shell
$ nodemcu-tool upload static/hello.html --keeppath
```

The remote file name will be "static/hello.html"

**Example 5**

Upload a text file and change its remote name.

```shell
$ nodemcu-tool upload HelloWorld.txt --remotename MyFile.txt
```

The remote file name will be "MyFile.txt"


### Download Files ###
To backup files or fetch recorded data, NodeMCU-Tool allows you to download these files from NodeMCU using the `download` command.
A file with the same name as the remote-file is created in the current working directory.
Expand Down
8 changes: 4 additions & 4 deletions bin/nodemcu-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var defaults = (function(){
port: '/dev/ttyUSB0',
optimize: false,
compile: false,
keepPath: false
keeppath: false
};

try{
Expand All @@ -50,7 +50,7 @@ var defaults = (function(){
config.port = d.port || config.port;
config.optimize = (d.optimize && d.optimize === true);
config.compile = (d.compile && d.compile === true);
config.keepPath = (d.keepPath && d.keepPath === true);
config.keeppath = (d.keeppath && d.keeppath === true);
console.log(_colors.cyan('[NodeMCU-Tool]'), 'Project based configuration loaded');
}
}catch (err){
Expand Down Expand Up @@ -96,7 +96,7 @@ _cli
// compile files after upload
.option('-c, --compile', 'Compile LUA file to bytecode (.lc) and remove the original file after upload', false)
// keep-path
.option('-k, --keeppath', 'Keep the original file path in the destination filename (i.e: static/test.html will be named static/test.html', false)
.option('-k, --keeppath', 'Keep a relative file path in the destination filename (i.e: static/test.html will be named static/test.html)', false)
.option('-n, --remotename <remotename>', 'Set destination file name. Default is same as original', false)

.action(function(localFile, options){
Expand All @@ -114,7 +114,7 @@ _cli
options.optimize = defaults.optimize;
}
if (!options.keeppath){
options.keeppath = defaults.keepPath;
options.keeppath = defaults.keeppath;
}

_nodemcutool.upload(_cli.port, _cli.baud, localFile, options, function(current, total){
Expand Down

0 comments on commit 1f18abb

Please sign in to comment.