This command-line tool allows users to interact with a doubly linked list via a set of commands. It supports reading integer data from a file, printing the data, loading the data into a doubly linked list while handling duplicates, and other utility commands such as clearing the screen and displaying help.
The tool can be run in two modes:
- Interactive Mode
- File Operation Mode
In interactive mode, users can enter commands directly to manipulate the linked list and perform other operations.
./doubleLinked.exe --interactive
or
./doubleLinked.exe -i
Once in interactive mode, the following commands are available:
- help: Displays the help information for interactive commands.
- read: Prompts the user to enter a filename and reads integer data from the file.
- print: Prints the data read from the file.
- load: Loads the data into the linked list, moving duplicates to the front.
- clear: Clears the screen.
- quit / exit: Exits the interactive mode.
In file operation mode, the tool performs a specific action on the data read from the file and then exits.
./doubleLinked.exe --file <filename> --action <action>
or
./doubleLinked.exe -f <filename> -a <action>
- 0: Reads data from the file and prints it.
- 1: Reads data from the file, loads it into the linked list, and then prints the list.
./doubleLinked.exe --interactive
./doubleLinked.exe --file data.txt --action 0
./doubleLinked.exe --file data.txt --action 1
The tool includes various error checks and will display appropriate error messages for issues such as insufficient arguments, failed file operations, and invalid commands.
- The tool assumes the file contains integers separated by spaces.
- The linked list operations are optimized for handling duplicate values by moving duplicates to the front of the list.
Save this content to a file named `README.md`. This file provides a comprehensive guide to using the command-line tool, detailing its functionalities, commands, and error handling.