Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#75 Added script to count lines in remote repository #115

Closed
wants to merge 1 commit into from

Conversation

Priyanshu-2005
Copy link

@Priyanshu-2005 Priyanshu-2005 commented Mar 17, 2024

Fixes #75
Added script that count lines in remote repository

OUTPUT
Command Used
bash gitlines <repo_url>
image

Command Used
bash gitlines
image

EXPLANATION OF CODE
if [ "$#" -eq 0 ]; then
Checks if no argument is passed then asks user to enter the repository name as argument

repo_url=$1
Stores the URL passed into the a variable named repo_url

temporary_directory=$(mktemp -d)
Creates a temporary directory and stores it in the variable named temporary_directory

git clone "$repo_url" "$temporary_directory"
Clones the given repository into the local system inside the temporary directory we created

cd "$temporary_directory" || exit
Changes the present working directory into temporary directory

cloc $temporary_directory
This command allows user to count no. of lines in the directory and displays them into the terminal according to the programming language

rm -rf "$temporary_directory"
Removes the directory to prevent the storage from getting full. rm -rf is used to forcefully remove the files and folders.

@ecxtacy
Copy link

ecxtacy commented Mar 17, 2024

Perfect ! Nice work @Priyanshu-2005.

@ecxtacy ecxtacy closed this Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write gitlines script.
2 participants