{"id":51115197,"url":"https://github.com/mukailasam/snip","last_synced_at":"2026-06-24T21:01:26.096Z","repository":{"id":319142040,"uuid":"1077727129","full_name":"mukailasam/snip","owner":"mukailasam","description":"Snip is a command-line tool that lets you download a specific directory or file from a GitHub repository without cloning the entire project.","archived":false,"fork":false,"pushed_at":"2025-10-16T17:33:46.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-17T20:16:29.420Z","etag":null,"topics":["cli","directory","download","file","folder","github","githubapi","go","repository","snip","tool"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mukailasam.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-16T16:44:43.000Z","updated_at":"2025-10-16T17:39:15.000Z","dependencies_parsed_at":"2025-10-18T07:22:11.846Z","dependency_job_id":"c001473d-c4aa-4d83-81f0-a6c9a5ac97e3","html_url":"https://github.com/mukailasam/snip","commit_stats":null,"previous_names":["mukailasam/snip"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mukailasam/snip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mukailasam%2Fsnip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mukailasam%2Fsnip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mukailasam%2Fsnip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mukailasam%2Fsnip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mukailasam","download_url":"https://codeload.github.com/mukailasam/snip/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mukailasam%2Fsnip/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34749211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-24T02:00:07.484Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cli","directory","download","file","folder","github","githubapi","go","repository","snip","tool"],"created_at":"2026-06-24T21:01:25.056Z","updated_at":"2026-06-24T21:01:26.091Z","avatar_url":"https://github.com/mukailasam.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ✂️ Snip\n\n```text\n _____       _\n/  ___|     (_)\n\\ `--. _ __  _ _ __\n `--. \\ '_ \\| | '_ \\\n/\\__/ / | | | | |_) |\n\\____/|_| |_|_| .__/\n              | |\n              |_|\n              get just what you need.\n```\n\n[![Go Version](https://img.shields.io/badge/Go-1.25+-blue.svg)](https://go.dev/)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)\n[![Go Report Card](https://goreportcard.com/badge/github.com/mukailasam/snip)](https://goreportcard.com/report/github.com/mukailasam/snip)\n\nSnip is a command-line tool that lets you download a specific folder or file from a GitHub repository without cloning the entire project.\n\n_If you only need one example, one subfolder, or a single config file, Snip gets it for you directly._\n\n## Features\n\n- Download a specific folder or a single file\n\n- Works for both public and private GitHub repositories\n\n- No Git clone - uses the GitHub REST API directly\n\n- Messages for rate limits and large repositories\n\n- Automatically detects the repo’s default branch\n\n- Built with [Cobra](https://github.com/spf13/cobra) for a clean CLI\n\n## Installation\n\nInstall it from the sources:\n\n```bash\ngit clone https://github.com/mukailasam/snip\ncd snip\ngo install\n```\n\nInstall it from the repository:\n\n```bash\ngo install github.com/mukailasam/snip\n```\n\n## Usage\n\n🗂️ Snip a folder\n\n```\n$ snip repo github.com/mukailasam/codelab --dir linear\n```\n\n📄 Snip a single file\n\n```\n$ snip repo github.com/mukailasam/codelab --file avl.go\n```\n\n📂 Specify a destination (optional)\n\n```\n$ snip repo github.com/mukailasam/codelab --dir array --dest /users/sam/desktop/workspace/temp\n```\n\nIf you don’t specify a destination using --dest, Snip saves the result in your current working directory.\n\n## 🔐 Private Repositories\n\nTo access private repositories, set your token via environment variable:\n\n```\nmacOS / Linux (bash/zsh)\nexport GITHUB_TOKEN=ghp_xxxxxxxxx\n\nWindows PowerShell\n$env:GITHUB_TOKEN = \"ghp_xxxxxxxxx\"\n```\n\nSnip automatically detects your token and uses it for private repo access.\n\n## Flags\n\nSnip commands accept the following flags:\n\n```text\n| Flag       | Description                                                  | Example              |\n|------------|--------------------------------------------------------------|----------------------|\n| `--dir`    | Name of the directory to snip from the repo                  | `--dir cmd`          |\n| `--file`   | Name of the file to snip from the repo.                      | `--file go.mod`      |\n| `--branch` | Branch to use (optional).                                    | `--branch main`      |\n| `--dest`   | Destination directory to save downloaded content (optional). | `--dest ./downloads` |\n\n```\n\n## Project Structure\n\n```text\ncmd/\n├── helper.go\n├── root.go         # Cobra CLI entrypoint\n├── repo.go         # Handles 'snip repo' command\ninternal/\n├── provider/\n│   ├── github.go   # GitHub API implementation\nutils/\n|    └── utils.go\nmain.go             # Main entrypoint\n```\n\n## How Snip Works\n\n- Parses the provided repo URL\n\n- Detects whether the repo is public or private.\n\n- Retrieves the default branch (if not specified).\n\n- Lists all files and directories via GitHub’s Tree API\n\n- Searches for the requested file or folder name.\n\n- Downloads matching content into the specified (or default) destination.\n\nSnip does not clone the repository or use Git — it talks directly to the provider’s REST API, keeping things lightweight and fast.\n\n## Example Output\n\n```\n$ go run snip.go repo github.com/mukailasam/codelab --file avl.go\n\n🌍 Public repository detected.\n🔍 Listing repository tree for mukailasam/codelab (branch: main)...\n⬇️ Downloaded: avl.go\n✅ Done.\n```\n\n## Why Snip?\n\nCloning an entire repository just to get one file or folder is inefficient.\nSnip saves time, bandwidth, and storage by letting you fetch only what you need directly from the GitHub API.\n\nIt’s perfect for developers who want a quick way to grab example files, configs, or small components without dealing with full clones or large repo histories.\n\n## Inspiration\n\nI needed a tool to quickly grab a single project, subfolder, configuration, or component from my \u003ca href=\"https://github.com/mukailasam/Codelab\" style=\"color: grey;\"\u003eCodelab\u003c/a\u003e without cloning the entire repository.\n\n## Contributing\n\nContributions are welcome!\nTo contribute:\n\n- Fork the repository\n\n- Create a new branch\n\n- Implement your feature or fix\n\n- Open a pull request\n\nMake sure to follow Go’s code formatting and keep your commits clean and descriptive.\n\n## License\n\nSnip is released under the MIT License. See LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmukailasam%2Fsnip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmukailasam%2Fsnip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmukailasam%2Fsnip/lists"}