diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 0000000..58b1880
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,3 @@
+# Ignore built files except build/index.js
+dist
+dist-dev
\ No newline at end of file
diff --git a/README.md b/README.md
index 4e91bf4..ed036d1 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,7 @@ Options:
--command command to run in terminal (shell by default)
--auto-restart restart command when on exit
--no-auto-restart do not restart command on exit
+ --html-path set path to html used to show terminal
```
### Windows
@@ -37,6 +38,55 @@ npm i gritty -g
Start `gritty`, and go to url `http://localhost:1337`
+## Customize the container of output
+
+
+
+Use the argument `html-path` to set the html path that will show the terminal:
+```bash
+gritty --html-path="/project/folder"
+```
+Could be used a html like that:
+```html
+
+
+
+ My custom title
+
+
+
+ My custom html!
+
+
+
+
+
+```
+
+
## API
### Client API
diff --git a/bin/gritty.js b/bin/gritty.js
old mode 100755
new mode 100644
index 7294555..50696ad
--- a/bin/gritty.js
+++ b/bin/gritty.js
@@ -14,6 +14,7 @@ const args = require('yargs-parser')(process.argv.slice(2), {
],
string: [
'command',
+ 'html-path',
],
alias: {
help: 'h',
@@ -42,6 +43,7 @@ function main() {
start({
port: args.port,
command: args.command,
+ htmlPath: args.htmlPath,
autoRestart: args.autoRestart,
});
}
@@ -58,12 +60,13 @@ function start(options) {
port,
command,
autoRestart,
+ htmlPath,
} = options;
check(port);
- const DIR = __dirname + '/../';
-
+ const DIR = htmlPath || __dirname + '/../';
+ console.log(DIR);
const gritty = require('../');
const http = require('http');
diff --git a/help.json b/help.json
index c7805d5..01bcbaf 100644
--- a/help.json
+++ b/help.json
@@ -5,5 +5,6 @@
"--port ": "set port number",
"--command ": "command to run (shell by default)",
"--auto-restart ": "restart command on exit",
- "--no-auto-restart ": "do not restart command on exit"
+ "--no-auto-restart ": "do not restart command on exit",
+ "--html-path ": "set path to html used to show terminal"
}
diff --git a/img/custom-html.png b/img/custom-html.png
new file mode 100644
index 0000000..dbf3380
Binary files /dev/null and b/img/custom-html.png differ
diff --git a/server/gritty.js b/server/gritty.js
index e40ccdd..1d4d7ed 100644
--- a/server/gritty.js
+++ b/server/gritty.js
@@ -12,6 +12,7 @@ const pty = require('node-pty');
const stringArgv = require('string-to-argv');
const terminalFn = currify(_terminalFn);
+const staticFn = currify(_staticFn);
const connectionWraped = wraptile(connection);
const CMD = process.platform === 'win32' ? 'cmd.exe' : 'bash';
@@ -42,7 +43,7 @@ module.exports = (options = {}) => {
router.route(prefix + '/*')
.get(terminalFn(options))
- .get(staticFn);
+ .get(staticFn(options));
return router;
};
@@ -60,7 +61,7 @@ function _terminalFn(options, req, res, next) {
next();
}
-function staticFn(req, res) {
+function _staticFn(options, req, res) {
const file = path.normalize(DIR_ROOT + req.url);
res.sendFile(file);
}