I will read the Package.swift file to identify the project's dependencies and structure.
I will read the Sources/XCSnippets/main.swift file to understand the CLI's interface and usage.
I will read the Sources/XCSnippetsCore/SnippetManager.swift file to understand the core functionality and commands of the SnippetManager.
I will read the Makefile to determine the installation instructions for the project.
I will read the Collections/main.json file to see the sample snippet repository list.
I will read the xcsnippets.1 man page to see if it provides any additional details for the documentation.
XCSnippets is a command-line tool designed to help iOS and macOS developers manage their Xcode code snippets using Git repositories. It allows you to easily install, update, and organize snippets across multiple machines.
- Fetch from Git: Download and install snippets directly from any Git repository (defaults to GitHub if only a handle/repo is provided).
- Update/Replace: Use the
-rflag to overwrite existing snippets with updated versions from a repository. - Auto-Naming: Automatically rename snippet files in your local directory from their default UUID-based names to human-readable titles.
- Quick Access: Quickly open the Xcode
CodeSnippetsdirectory in Finder. - Sample Collections: Access a curated list of sample snippet repositories.
- macOS 10.14 or later
- Xcode and Swift (built using Swift Package Manager)
- Git
-
Clone the repository:
git clone https://github.com/dtaylor1701/XCSnippets.git cd XCSnippets -
Build and install using the included Makefile:
make install
This will install the
xcsnippetsbinary to/usr/local/bin/and its man page to/usr/local/share/man/man1/.
-
Install snippets from a GitHub repository:
xcsnippets dtaylor1701/XCUISnippets
-
Install snippets from any Git repository:
xcsnippets https://github.com/user/my-snippets.git
-
Replace existing snippets with the same name:
xcsnippets -r dtaylor1701/XCUISnippets
| Option | Description |
|---|---|
-h |
Show help information. |
-l |
List a sample of available snippet repositories. |
-n |
Rename current snippets in the Xcode folder based on their titles. |
-o |
Open the Xcode snippets folder in Finder. |
-r |
Replace existing snippets with the same name when fetching. |
- Sources/XCSnippets: The CLI entry point and argument parsing.
- Sources/XCSnippetsCore: The core logic for managing snippets, interacting with the file system, and executing shell commands.
- Collections: A local reference for sample snippet repositories.
- Tests: Unit tests for the core functionality.
XCSnippets is built using the Swift Package Manager and has no external library dependencies, keeping it lightweight and fast.
This project is licensed under the MIT License. See the LICENSE file for details.
David Taylor
dktaylor1701@gmail.com