From a3eb406771bf183f51fe363c119438d48d7da0b4 Mon Sep 17 00:00:00 2001 From: Ezequiel Santos Date: Thu, 4 Jul 2024 21:27:16 +0100 Subject: [PATCH] Update README.md --- .github/README.md | 54 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/.github/README.md b/.github/README.md index b642fd2..d81a731 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,4 +1,3 @@ - # check-permissions [![Swift](https://github.com/ezefranca/check-permissions/actions/workflows/swift.yml/badge.svg)](https://github.com/ezefranca/check-permissions/actions/workflows/swift.yml) ## Overview @@ -15,14 +14,14 @@ The **Check Permissions** CLI tool is a Swift-based command line application des ### Prerequisites -- macOS 11.0 or later +- macOS 12.0 or later - Swift 5.3 or later ### Steps 1. **Clone the Repository**: ```sh - git clone + git clone https://github.com/ezefranca/check-permissions.git cd check-permissions ``` @@ -32,7 +31,7 @@ The **Check Permissions** CLI tool is a Swift-based command line application des ./install.sh ``` -The installation script will compile the tool and install it to `/usr/local/bin`, making it available globally as `check-permissions`. +The installation script will compile the tool and install it to `/usr/local/bin`, making it available globally as `check-permissions-cli`. ## Usage @@ -46,13 +45,13 @@ The installation script will compile the tool and install it to `/usr/local/bin` To scan a `Pods` directory for `Info.plist` files and report the permissions: ```sh -check-permissions --path /Users/yourusername/Developer/YourProject/Pods +check-permissions-cli --path /Users/yourusername/Developer/YourProject/Pods ``` To display the help message: ```sh -check-permissions --help +check-permissions-cli --help ``` ### Sample Output @@ -68,6 +67,49 @@ File: /Users/yourusername/Developer/YourProject/Pods/ModuleB/Info.plist No permissions found in any Info.plist files. ``` +## Using as a Package + +To use the **Check Permissions** package in your Swift project, add it as a dependency in your `Package.swift`: + +```swift +// swift-tools-version:5.4 +import PackageDescription + +let package = Package( + name: "YourProject", + platforms: [ + .iOS(.v15), + .macOS(.v12), + .watchOS(.v9), + .tvOS(.v15), + .visionOS(.v1) + ], + dependencies: [ + .package(url: "https://github.com/ezefranca/check-permissions", from: "0.0.2"), + ], + targets: [ + .target( + name: "YourProject", + dependencies: ["check-permissions"]), + ] +) +``` + +Then import and use it in your code: + +```swift +import check_permissions + +let checker = PermissionChecker() +let report = checker.generateReport(for: URL(fileURLWithPath: "/path/to/Pods")) +for (plistPath, permissions) in report { + print("File: \(plistPath)") + for permission in permissions { + print(" - \(permission)") + } +} +``` + ## Contributing We welcome contributions to enhance the functionality of this tool. Please follow these steps to contribute: