{"id":19509899,"url":"https://github.com/dattali18/github-cloc","last_synced_at":"2025-02-25T22:45:11.953Z","repository":{"id":245076882,"uuid":"817194077","full_name":"dattali18/github-cloc","owner":"dattali18","description":"A repo for a nice and useful bash script that will clone and count the amount of code written by a user","archived":false,"fork":false,"pushed_at":"2024-09-18T12:20:15.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-08T11:46:32.534Z","etag":null,"topics":["bash","bash-script","git","github","linux","unix"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dattali18.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-19T07:57:38.000Z","updated_at":"2024-11-29T07:09:40.000Z","dependencies_parsed_at":"2024-06-19T16:21:10.882Z","dependency_job_id":"a5b63ade-1d40-4c84-a1f4-72f05f8be829","html_url":"https://github.com/dattali18/github-cloc","commit_stats":null,"previous_names":["dattali18/github-cloc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dattali18%2Fgithub-cloc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dattali18%2Fgithub-cloc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dattali18%2Fgithub-cloc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dattali18%2Fgithub-cloc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dattali18","download_url":"https://codeload.github.com/dattali18/github-cloc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240761122,"owners_count":19853255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-script","git","github","linux","unix"],"created_at":"2024-11-10T23:13:51.654Z","updated_at":"2025-02-25T22:45:11.865Z","avatar_url":"https://github.com/dattali18.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub User Repositories Line of Code Counter\n\nThis bash script takes a GitHub username, downloads all the public repositories of that user, and then uses the `cloc` and `jq` tools to count the lines of code the user has written for each programming language.\n\n## Requirements\n\nTo run this script, you need to have the following installed:\n1. **bash**\n2. **jq**: A JSON query tool, very useful for working with JSON data.\n3. **cloc**: A tool to count lines of code.\n\n## Usage\n\n1. Clone this repository or copy the script to your local machine.\n2. Open the script in a text editor and replace the `USERNAME` variable with your GitHub username.\n3. Save the changes and close the editor.\n4. Open a terminal and navigate to the directory where the script is located.\n5. Make the script executable by running:\n   ```bash\n   chmod +x script_name.sh\n   ```\n6. Run the script:\n   ```bash\n   ./script_name.sh\n   ```\n7. The script will create a directory with your GitHub username, clone all your public repositories into that directory, and generate a `result.csv` file with the lines of code statistics.\n\n## Example Output\n\nHere is an example of what the `result.csv` file might look like:\n\n|files |language               |blank |comment |code   |\n|------|-----------------------|------|--------|-------|\n|89    |SQL                    |242   |137     |5197571|\n|35    |CSV                    |0     |0       |1713189|\n|15    |Text                   |0     |0       |202103 |\n|42    |JSON                   |3     |0       |78518  |\n|117   |Markdown               |5645  |31      |16945  |\n|121   |JavaScript             |3814  |3954    |12848  |\n|103   |CSS                    |2477  |726     |9456   |\n|113   |C#                     |1650  |1206    |7713   |\n|116   |C++                    |1398  |2604    |7649   |\n|120   |Swift                  |2134  |1316    |7605   |\n|64    |HTML                   |939   |115     |7568   |\n|126   |Python                 |1859  |1264    |5660   |\n|61    |Java                   |1602  |2570    |5429   |\n|85    |JSX                    |726   |179     |4749   |\n|86    |XML                    |1     |23      |4086   |\n|57    |C/C++ Header           |955   |548     |2651   |\n|19    |XAML                   |253   |46      |2082   |\n|19    |Jupyter Notebook       |0     |2174    |1907   |\n|15    |SCSS                   |482   |325     |1896   |\n|47    |TypeScript             |177   |51      |1758   |\n|6     |R                      |165   |126     |244    |\n|5     |Visual Studio Solution |5     |5       |244    |\n|10    |MSBuild script         |38    |0       |194    |\n|40    |SVG                    |0     |0       |145    |\n|5     |Bourne Shell           |25    |26      |59     |\n|2     |YAML                   |8     |59      |54     |\n|2     |Bourne Again Shell     |21    |22      |46     |\n|1     |Assembly               |7     |3       |44     |\n|2     |CMake                  |13    |10      |42     |\n|1     |GDScript               |7     |0       |32     |\n|1     |INI                    |3     |0       |17     |\n|3     |Pug                    |2     |0       |16     |\n|1528  |SUM                    |24651 |17520   |7292520|\n\n\n\n## Script\n\n```bash\n#!/bin/bash\n\n# GitHub username\n# NOTE: change this to be your username on GitHub\nUSERNAME=\"dattali18\"\n\n# Create a directory to store the cloned repositories\nmkdir -p $USERNAME\ncd $USERNAME\n\n# Get all repositories for the user\nREPOS=$(curl -s \"https://api.github.com/users/$USERNAME/repos?per_page=100\" | jq -r '.[].clone_url')\n\n# Clone each repository\nfor REPO in $REPOS; do\n    git clone $REPO\ndone\n\n# Run cloc on all repositories and save the results to result.csv\ncloc . --csv --out=result.csv\n\necho \"Lines of code and programming languages statistics saved to result.csv\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdattali18%2Fgithub-cloc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdattali18%2Fgithub-cloc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdattali18%2Fgithub-cloc/lists"}