Skip to content

It is a Console based Todo Application written in C language. Uses concepts like file management, pointers, strings, function approach.

Notifications You must be signed in to change notification settings

29rohitkr/todo-C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

todo-c

It is a todo app in c language

Todo-CLI *Some functions are same as shown in video(written in javascript).

Getting started

  1. You should have a C compiler available for building the code.

  2. $ gcc todo.c -o todo.out

    On *nix:

    ./todo.sh
    

On *nix:

Run the following command in your shell:

$ ln -s todo.sh todo

Manually create todo.txt and done.txt

Specification

  1. The app can be run in the console with ./todo.

  2. The app will 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.

water the plants
change light bulb
  1. When a todo item is completed, it will be removed from todo.txt and instead added to the done.txt text file. This file has a different format:

    x the text contents of the todo item
    1. format the letter x
    2. the original text

Usage

1. Help

Executing the command without any arguments, or with a single argument help prints the CLI usage.

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

2. List all pending todos

Use the ls command to see all the todos that are not yet complete.

$ ./todo ls
[1] change light bulb
[2] water the plants

3. Add a new todo

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).

$ ./todo add "the thing i need to do"
Added todo: "the thing i need to do"

4. Delete a todo item

Use the del command to remove a todo item by its number.

$ ./todo del 3
Deleted todo #3

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

$ ./todo del 5
Error: todo #5 does not exist. Nothing deleted.

5. Mark a todo item as completed

Use the done command to mark a todo item as completed by its number.

$ ./todo done 1
Marked todo #1 as done.

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

$ ./todo done 5
Error: todo #5 does not exist.

6. Generate a report

Use the report command to see the latest tally of pending and completed todos.

$ ./todo report
yyyy-mm-dd Pending : 1 Completed : 4

About

It is a Console based Todo Application written in C language. Uses concepts like file management, pointers, strings, function approach.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published