#75 Added script to count lines in remote repository #115
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #75
Added script that count lines in remote repository
OUTPUT
Command Used
bash gitlines <repo_url>
Command Used
bash gitlines
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.