Skip to content

Commit

Permalink
Case-sensitive user inputs (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirsle committed Oct 2, 2021
1 parent 32acde1 commit c4b5ce6
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 185 deletions.
1 change: 0 additions & 1 deletion mkdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def render_markdown(title, path, text):
text=markdown.markdown(text,
extensions=[
"fenced_code",
"smart_strong",
"codehilite",
"sane_lists",
],
Expand Down
17 changes: 11 additions & 6 deletions shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ var opts = {
debug: false,
utf8: false,
watch: false,
caseSensitive: false,
brain: undefined
};

process.argv.slice(2).forEach(function(val, index, array) {
process.argv.slice(2).forEach(function (val, index, array) {

if (val === "--debug") {
opts.debug = true;
Expand All @@ -41,6 +42,9 @@ process.argv.slice(2).forEach(function(val, index, array) {
else if (val === "--watch") {
opts.watch = true;
}
else if (val.indexOf("--case") > -1) {
opts.caseSensitive = true;
}
else if (val.indexOf("-") === 0) {
console.error("Unknown option: %s", val);
}
Expand Down Expand Up @@ -70,14 +74,15 @@ var rl = readline.createInterface({

var ready = false;
var bot = new RiveScript({
debug: opts.debug,
utf8: opts.utf8,
debug: opts.debug,
utf8: opts.utf8,
concat: "newline",
caseSensitive: opts.caseSensitive,
// sessionManager: new NullSessionManager()
});

if (opts.watch) {
fs.watch(opts.brain, {recursive: false}, function() {
fs.watch(opts.brain, { recursive: false }, function () {
console.log("");
console.log('[INFO] Brain changed, reloading bot.');
rl.prompt();
Expand Down Expand Up @@ -105,7 +110,7 @@ console.log("");

rl.setPrompt("You> ");
rl.prompt();
rl.on('line', async function(cmd) {
rl.on('line', async function (cmd) {
// Handle commands.
if (cmd === "/help") {
help();
Expand All @@ -128,7 +133,7 @@ rl.on('line', async function(cmd) {
}

rl.prompt();
}).on('close', function() {
}).on('close', function () {
console.log("");
process.exit(0);
});
Expand Down
Loading

0 comments on commit c4b5ce6

Please sign in to comment.