Skip to content

Commit

Permalink
change cli command references to todo.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jcsherin committed Dec 13, 2020
1 parent 519dcd8 commit b765aaa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ See `Makefile` comments to see how language specific zip archives are created.

- [x] C++
- [x] JavaScript
- [ ] Java
- [ ] Python
- [ ] Ruby
- [x] Java
- [x] Python
- [x] Ruby

### Run

Expand Down
36 changes: 18 additions & 18 deletions shared/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Here's how it should work when you're done:

## Specification

1. The app can be run in the console with `node todo.js`.
1. The app can be run in the console with `./todo.sh`.

2. The app should read from and write to a `todo.txt` text file. Each todo item occupies a single line in this file. Here is an example file that has 2 todo items.

Expand All @@ -41,10 +41,10 @@ x 2020-06-12 the text contents of the todo item

The date when the todo is marked as completed is recorded in the `yyyy-mm-dd` format (ISO 8601). For example, a date like `15th August, 2020` is represented as `2020-08-15`.

4. The application must open the files `todo.txt` and `done.txt` from where the app is run, and not where the app is located. For example, if we invoke the app like this:
4. The application must open the files `todo.txt` and `done.txt` from where the app is run, and not where the app is located. For example, if we invoke the app like this:

$ cd ~/plans
$ node ~/apps/todo.js ls
$ cd ~/plans
$ ~/apps/todo.sh ls

The application should look for the text files in ~/plans, since that is the user’s current directory.

Expand All @@ -55,22 +55,22 @@ The application should look for the text files in ~/plans, since that is the use
Executing the command without any arguments, or with a single argument `help` prints the CLI usage.

```
$ node todo.js help
$ ./todo.sh help
Usage :-
$ node todo.js add "todo item" # Add a new todo
$ node todo.js ls # Show remaining todos
$ node todo.js del NUMBER # Delete a todo
$ node todo.js done NUMBER # Complete a todo
$ node todo.js help # Show usage
$ node todo.js report # Statistics
$ ./todo.sh add "todo item" # Add a new todo
$ ./todo.sh ls # Show remaining todos
$ ./todo.sh del NUMBER # Delete a todo
$ ./todo.sh done NUMBER # Complete a todo
$ ./todo.sh help # Show usage
$ ./todo.sh report # Statistics
```

### 2. List all pending todos

Use the `ls` command to see all the todos that are not yet complete. The most recently added todo should be displayed first.

```
$ node todo.js ls
$ ./todo.sh ls
[2] change light bulb
[1] water the plants
```
Expand All @@ -80,7 +80,7 @@ $ node todo.js ls
Use the `add` command. The text of the todo item should be enclosed within double quotes (otherwise only the first word is considered as the todo text, and the remaining words are treated as different arguments).

```
$ node todo.js add "the thing i need to do"
$ ./todo.sh add "the thing i need to do"
Added todo: "the thing i need to do"
```

Expand All @@ -89,14 +89,14 @@ Added todo: "the thing i need to do"
Use the `del` command to remove a todo item by its number.

```
$ node todo.js del 3
$ ./todo.sh del 3
Deleted todo #3
```

Attempting to delete a non-existent todo item should display an error message.

```
$ node todo.js del 5
$ ./todo.sh del 5
Error: todo #5 does not exist. Nothing deleted.
```

Expand All @@ -105,14 +105,14 @@ Error: todo #5 does not exist. Nothing deleted.
Use the `done` command to mark a todo item as completed by its number.

```
$ node todo.js done 1
$ ./todo.sh done 1
Marked todo #1 as done.
```

Attempting to mark a non-existed todo item as completed will display an error message.

```
$ node todo.js done 5
$ ./todo.sh done 5
Error: todo #5 does not exist.
```

Expand All @@ -121,6 +121,6 @@ Error: todo #5 does not exist.
Use the `report` command to see the latest tally of pending and completed todos.

```
$ node todo.js report
$ ./todo.sh report
dd/mm/yyyy Pending : 1 Completed : 4
```

0 comments on commit b765aaa

Please sign in to comment.