A C++ based command-line (CLI) program that lets you manage your tasks

Overview

COMMAND LINE INTERFACE TODO APP

a command-line (CLI) program that lets you manage your tasks.

The specification for this project is written down as tests

Here's how it works:

TASK-CLI

Getting started

  1. Install CPP: You should have build support for cpp on your system.

  2. You are expected to write the code in task.cpp file.

  3. You should be able to build the app by running make app.

  4. Once you are done with the changes you should be able to execute the task app by running the following command from the terminal.

    On Windows:

    .\task.bat
    

    On *nix:

    ./task.sh
    

Run Automated Tests

1. Install Node.js

You need to have npm installed in your computer for this problem. It comes with Node.js and you can get it by installing Node from https://nodejs.org/en/

2. Install dependencies

Run npm install to install all dependencies.

3. Create Create symbolic link to the executable file

On Windows

To create a symbolic link on Windows, you'll need to run either the Windows Command Prompt, or Windows Powershell with administrator privileges. To do so, right-click on the icon for Command Prompt, or Powershell, and choose the "Run as Administrator" option.

Command Prompt:

> mklink task task.bat

Powershell:

> cmd /c mklink task task.bat

On *nix:

Run the following command in your shell:

$ ln -s task.sh task

4. Try running tests.

Now run npm test and you will see all the tests failing. As you fill in each functionality, you can re-run the tests to see them passing one by one.

A Note about / for Windows Users

In the following sections, you'll see many commands prefixed with ./, or paths containing the / (forward-slash) character.

If you're using the Windows Command Prompt, then you'll need to replace / with \ (back-slash) for these commands and paths to work as expected.

On Windows Powershell, these substitutions are not required.

Known Issues

A few notes to help you avoid any hiccups while implementing the programming challenge:

  1. If you are on Windows, you might have difficulty getting the tests to pass because of newline UTF encoding issues. If you get stuck, please refer to the thread here.

  2. In Windows machines, the make command might not exist and can prevent you from running the tests. This can be fixed by using WSL, or installing MinGW, among other options.

Specification

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

  2. The app should read from and write to a task.txt text file. Each task occupies a single line in this file. Each line in the file should be in this format :

    p task
    

    where p is the priority ( priority will be a number) and task is the task description.

    Priority denotes how important a task is, if it is a high priority task, it should be completed earlier. Priority is denoted using an integer, the lower the number, the higher the priority.

    Here is an example file that has 2 items.

    1 Buy milk
    2 Complete the project
    
  3. Completed task are writted to a completed.txt file. Each task occupies a single line in this file. Each line in the file should be in this format :

    task
    

    where task is the task description.

    Here is an example file that has 2 items.

    Buy milk
    Complete the project
    
  4. Priority can be any integer greater than or equal to 0. 0 being the highest priority

  5. If two task have the same priority, the task that was added first should be displayed first.

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

  6. The files should always be sorted in order of the priority, ie, the task with the highest priority should be first item in the file.

    $ cd /path/to/plans
    
    $ /path/to/apps/task ls
    

    The application should look for the text files in /path/to/plans, since that is the userโ€™s current directory.

Please note that the programming task could be completed without the use of any additional packages

Usage

1. Help

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

$ ./task help
Usage :-
$ ./task add 2 hello world    # Add a new item with priority 2 and text "hello world" to the list
$ ./task ls                   # Show incomplete priority list items sorted by priority in ascending order
$ ./task del INDEX            # Delete the incomplete item with the given index
$ ./task done INDEX           # Mark the incomplete item with the given index as complete
$ ./task help                 # Show usage
$ ./task report               # Statistics

2. List all pending items

Use the ls command to see all the items that are not yet complete, in ascending order of priority.

Every item should be printed on a new line. with the following format

[index] [task] [priority]

Example:

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

index starts from 1, this is used to identify a particular task to complete or delete it.

3. Add a new item

Use the add command. The text of the task should be enclosed within double quotes (otherwise only the first word is considered as the item text, and the remaining words are treated as different arguments).

$ ./task add 5 "the thing i need to do"
Added task: "the thing i need to do" with priority 5

4. Delete an item

Use the del command to remove an item by its index.

$ ./task del 3
Deleted item with index 3

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

$ ./task del 5
Error: item with index 5 does not exist. Nothing deleted.

5. Mark a task as completed

Use the done command to mark an item as completed by its index.

$ ./task done 1
Marked item as done.

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

$ ./task done 5
Error: no incomplete item with index 5 exists.

6. Generate a report

Show the number of complete and incomplete items in the list. and the complete and incomplete items grouped together.

$ ./task report
Pending : 2
1. this is a pending task [1]
2. this is a pending task with priority [4]

Completed : 3
1. completed task
2. another completed task
3. yet another completed task
You might also like...

SFDX Plugin to set Email Deliverability Access Level for an org easily and quickly via command line interface

SFDX Plugin to set Email Deliverability Access Level for an org easily and quickly via command line interface

Dec 16, 2022

A project for FAST command line interface tools.

FAST CLI Project This is the FAST CLI project, containing the FAST CLI package and other related CLI packages for FAST project creation and management

Dec 5, 2022

A command line interface for programmatically creating data silos on app.transcend.io

Table of Contents Overview Installation Authentication transcend.yml Usage tr-pull tr-push CI Integration Dynamic Variables tr-scan Overview A command

Dec 13, 2022

Generate a Node.js command line tool from an OpenAPI definition

OpenAPI Commander Generate a Node.js command line tool from an OpenAPI definition using the commander library. Example usage Usage: Subcommands groupe

Jan 3, 2023

Windows command line tool to block outbound connections for files within a directory.

fwg A Windows command line tool to block outbound connections for files within a directory. fwg utilizes the power of PowerShell and Windows Network S

Jul 19, 2022

The command-line interface for versum

@versumstudios/cli The command-line interface for versum. versum-cli Usage Contributing How to use Export Templates Usage To install the latest versio

Nov 3, 2022

A simple CLI tool to create and manage xhelpers-api projects

A simple CLI tool to create and manage xhelpers-api projects

Feb 25, 2022

CLI Command for Two Factor Authentication.๐Ÿš€

CLI Command for Two Factor Authentication.๐Ÿš€

Nov 5, 2022

Tasks Management CLI application with Nodejs, Mongodb, inquirer.js, and commander

Tasks CLI Tasks CLI is a program to manage your tasks in a database using terminal or console. This is a sample project for beginners Requirements Nod

Nov 17, 2022
Owner
Rahul Prabhakar
Rahul Prabhakar
Autify Command Line Interface (CLI)

Autify Command Line Interface (CLI) Autify CLI can help your integration with Autify! Autify Command Line Interface (CLI) Usage Commands Usage Note: n

Autify 36 Jan 2, 2023
1History is a command line tool to backup your histories of different browsers into one place

1History All your history in one place. 1History is a command line tool to backup your histories of different browsers into one place. Features Suppor

null 340 Dec 31, 2022
a simple zero-configuration command-line http server

http-server: a command-line http server http-server is a simple, zero-configuration command-line http server. It is powerful enough for production usa

http ... PARTY! 12.4k Jan 4, 2023
Control the macOS dark mode from the command-line

dark-mode Control the macOS dark mode from the command-line Requires macOS 10.10 or later. macOS 10.13 or earlier needs to download the Swift runtime

Sindre Sorhus 630 Dec 30, 2022
node.js command-line interfaces made easy

Commander.js The complete solution for node.js command-line interfaces. Read this in other languages: English | ็ฎ€ไฝ“ไธญๆ–‡ Commander.js Installation Declari

TJ Holowaychuk 24k Jan 8, 2023
๐ŸŒˆ React for interactive command-line apps

React for CLIs. Build and test your CLI output using components. Ink provides the same component-based UI building experience that React offers in the

Vadim Demedes 19.7k Jan 9, 2023
Pretty unicode tables for the command line

cli-table3 This utility allows you to render unicode-aided tables on the command line from your node.js scripts. cli-table3 is based on (and api compa

null 418 Dec 28, 2022
Control the Plash app from the command-line

plash-cli Control the Plash app from the command-line Install $ npm install --global plash Requires Node.js 14 or later. Requires Plash 2.3.0 or late

Sindre Sorhus 33 Dec 30, 2022
Close chrome tabs from command-line (macOS only)

Close-tab Read all tabs from an activated window of the chrome, open with vi prompt, you can close tabs by deleting lines. Istallation npm install -g

Karl Saehun Chung 8 Jun 18, 2022
Wordle and Termooo style classic word guessing game for the command line. One new word per day!

Wordle and Termooo style classic word guessing game for the command line. One new word per day!

Anderson Silva 3 Nov 27, 2022