Skip to content

Commit b48dbe4

Browse files
karynad-stackJeremy Skirrow
authored andcommitted
Update notes.js
1 parent 5bac908 commit b48dbe4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

notes.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,21 @@ function main() {
3939
}
4040
break;
4141
}
42+
case "edit": {
43+
const id = Number(rest[0]);
44+
const text = rest.slice(1).join(" ").trim();
45+
store.edit(id, text);
46+
console.log(`Updated note #${id}`);
47+
break;
48+
}
4249
case "delete": {
4350
const id = Number(rest[0]);
4451
const ok = store.remove(id);
4552
console.log(ok ? `Deleted note #${id}` : `No note #${id} found`);
4653
break;
4754
}
4855
default:
49-
console.log("Commands: add <text> | list | search <term> | delete <id>");
56+
console.log("Commands: add <text> | list | search <term> | edit <id> <text> | delete <id>");
5057
console.log(`(Session locks after ${config.SESSION_TIMEOUT_MINUTES} minutes of inactivity.)`);
5158
}
5259
}

0 commit comments

Comments
 (0)