Before you begin, ensure that you have the following prerequisites installed on your system:
- Rust Programming Language: This application is developed in Rust. Inorder to compile make sure you have Rust installed on your machine. You can download Rust from Rust's official website.
To compile and run the Rust List Combination Application, follow the steps below:
-
Clone the Repository:
$ git clone https://github.com/Lightmean03/listKitten.git $ cd listKitten
-
Compile the Application:
$ cargo build -r
-
Run the Application:
$ target/release/ $ ./listKitten -m mode -f file1.txt -F file2.txt -o output.txt
listKitten accepts the following command-line options:
-
Mode (
-m
or--mode
): Specify the mode of operation. Choose from the following options:left
: Combine the first list with the second list.right
: Combine the second list with the first list.left_space
: Combine the first list with the second list with space.right_space
: Combine the second list with the first list with space.all_space
: Combine the lists with a space between each word.all
: Combine the lists in both directions.perm
: all combinations of a single listperm_space
: all combinations of a single list with spacespattern
: Apply a specific pattern to manipulate the lists.
-
Pattern (
-p
or--pattern
): Specify a pattern when using thepattern
mode. The pattern can include:N
: Numbers 0-9.Z
: Alphabet._
: Space.
-
File Path 1 (
-f
or--file1
): Path to the first input file. -
File Path 2 (
-F
or--file2
): Path to the second input file. -
Output File (
-o
or--output
): Path to the output file.
Here are some examples of how to use the Rust List Combination Application with different modes:
-
Combine lists with spaces:
$ ./listKitten -m all_space -f list1.txt -F list2.txt -o output.txt
-
Apply a pattern to manipulate lists:
$ ./listKitten -m pattern -p N_Z -f list1.txt -F list2.txt -o output.txt
Consider the scenario where we have two input lists, list1.txt
and list2.txt
. We want to combine these lists in both directions, creating a new output list named output.txt
.
$ cat list1.txt
red
blue
green
brown
$ cat list2.txt
john
jake
jac
$ ./listKitten -m all -f list1.txt -F list2.txt -o output.txt
$ cat output.txt
redjohn
redjake
redjack
bluejohn
bluejake
bluejack
greenjohn
greenjake
greenjack
brownjohn
brownjake
brownjack
johnred
johnblue
johngreen
johnbrown
jakered
jakeblue
jakegreen
jakebrown
jackred
jackblue
jackgreen
jackbrown