Skip to content

cupid-lc a line count program to get the line count of a single file or directories which contain files.

License

Notifications You must be signed in to change notification settings

cupidthecat/cupid-lc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cupid-lc

cupid-lc is a line count utility written in C for Unix and Linux systems. It calculates the total number of lines across files in a given directory or for a single file. The output includes both a cumulative total and individual line counts for each file processed.

Features

  • Counts the total lines in a directory (including subdirectories) or a single file.
  • Provides a line count for each file and a cumulative total.
  • Recursive directory traversal for in-depth counting.
  • Simple command-line interface, easy to integrate into scripts or workflows.

Screenshot

Cupid-LC Example

Example Usage

To use cupid-lc, simply pass a file or directory as an argument.

# Count lines in a directory
./cupid-lc src/

# Sample output:
# cupid-lc: line count per src/main.c : 73
# cupid-lc: line count total: 73

Or pass a single file:

./cupid-lc test.txt

# Sample output:
# cupid-lc: line count per test.txt: 3
# cupid-lc: line count total: 3

Installation

To compile the program, clone the repository and use gcc to build the executable.

git clone https://github.com/username/cupid-lc.git
cd cupid-lc
gcc src/main.c -o cupid-lc

When you're done building, I suggest moving the executable to the /usr/bin/ directory for system-wide use in the terminal.

Replace username with your GitHub username.

Usage

Run the compiled cupid-lc with the directory or file path as an argument:

./cupid-lc [directory_or_file]

Command-Line Argument

  • [directory_or_file]: The path to a directory or a file for which to calculate line counts.

Output

The program will print the line count for each file, followed by a total line count. The format is as follows:

cupid-lc: line count per <filename>: <line_count>
cupid-lc: line count total: <total_line_count>

Example Output

For a directory containing multiple files:

cupid-lc: line count per src/main.c : 301
cupid-lc: line count per src/count.c: 2000
cupid-lc: line count total: 2301

For a single file:

cupid-lc: line count per test.txt: 42
cupid-lc: line count total: 42

License

This project is licensed under the GNU v3 License - see the LICENSE file for details.


About

cupid-lc a line count program to get the line count of a single file or directories which contain files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages