Repository navigation
Update README.rst - #1094
Open
Thegee87 wants to merge 1 commit into
Open
Update README.rst#1094Thegee87 wants to merge 1 commit into
Thegee87 wants to merge 1 commit into
Conversation
#!/usr/bin/env bash
set -euo pipefail
FORK_REMOTE="fork"
FORK_URL="git@github.com:Thegee87/KeychainAccess.git"
BRANCH="add-contributing-md"
# Ensure inside git repo
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "Error: run this from the root of your local clone of KeychainAccess."
exit 1
fi
# Add or update fork remote
if git remote get-url "$FORK_REMOTE" >/dev/null 2>&1; then
echo "Remote '$FORK_REMOTE' already exists: $(git remote get-url "$FORK_REMOTE")"
# If it's different, update it
if [ "$(git remote get-url "$FORK_REMOTE")" != "$FORK_URL" ]; then
echo "Updating '$FORK_REMOTE' to $FORK_URL"
git remote set-url "$FORK_REMOTE" "$FORK_URL"
fi
else
echo "Adding remote '$FORK_REMOTE' -> $FORK_URL"
git remote add "$FORK_REMOTE" "$FORK_URL"
fi
# Create or switch to branch
if git show-ref --verify --quiet "refs/heads/$BRANCH"; then
echo "Switching to existing local branch '$BRANCH'."
git checkout "$BRANCH"
else
echo "Creating and switching to branch '$BRANCH'."
git checkout -b "$BRANCH"
fi
# Overwrite CONTRIBUTING.md
cat > CONTRIBUTING.md <<'EOF'
# Contributing to KeychainAccess
Thank you for your interest in contributing! This document explains how to set up the project locally, run tests, and make changes that are easy for maintainers to review.
## Quick start
1. Fork the repository and clone your fork:
git clone git@github.com:<your-username>/KeychainAccess.git
cd KeychainAccess
2. Create a branch for your change:
git checkout -b add-contributing-md
3. Make small, focused changes. Add tests where appropriate.
4. Run tests and formatting locally (see the Testing section).
5. Push your branch and open a Pull Request against the upstream default branch.
## Development setup
### Swift Package Manager (recommended)
- Build:
swift build
- Run tests:
swift test
- Resolve dependencies:
swift package resolve
### Xcode
- Open `KeychainAccess.xcworkspace` (or `Lib/KeychainAccess.xcodeproj`).
- Select the app or test target and run or test from Xcode.
## Usage snippets (subscripting)
From the README (see https://github.com/kishikawakatsumi/KeychainAccess#subscripting):
```swift
import KeychainAccess
let keychain = Keychain(service: "com.example.github-token")
keychain["kishikawakatsumi"] = "01234567-89ab-cdef-0123-456789abcdef" // store
let token = keychain["kishikawakatsumi"] // read (Optional<String>)
keychain["kishikawakatsumi"] = nil // remove
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#!/usr/bin/envbashset -euo pipefail
FORK_REMOTE="fork"
FORK_URL="git@github.com:Thegee87/KeychainAccess.git" BRANCH="add-contributing-md"
Ensure inside git repo
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "Error: run this from the root of your local clone of KeychainAccess."
exit 1
fi
Add or update fork remote
if git remote get-url "$FORK_REMOTE" >/dev/null 2>&1; then
echo "Remote '$FORK_REMOTE' already exists: $(git remote get-url "$FORK_REMOTE")"
If it's different, update it
if [ "$(git remote get-url "$FORK_REMOTE")" != "$FORK_URL" ]; then
echo "Updating '$FORK_REMOTE' to $FORK_URL"
git remote set-url "$FORK_REMOTE" "$FORK_URL"
fi
else
echo "Adding remote '$FORK_REMOTE' -> $FORK_URL"
git remote add "$FORK_REMOTE" "$FORK_URL"
fi
Create or switch to branch
if git show-ref --verify --quiet "refs/heads/$BRANCH"; then
echo "Switching to existing local branch '$BRANCH'."
git checkout "$BRANCH"
else
echo "Creating and switching to branch '$BRANCH'."
git checkout -b "$BRANCH"
fi
Overwrite CONTRIBUTING.md
cat > CONTRIBUTING.md <<'EOF'
Contributing to KeychainAccess
Thank you for your interest in contributing! This document explains how to set up the project locally, run tests, and make changes that are easy for maintainers to review.
Quick start
Fork the repository and clone your fork: git clone git@github.com:/KeychainAccess.git cd KeychainAccess
Create a branch for your change: git checkout -b add-contributing-md
Make small, focused changes. Add tests where appropriate.
Run tests and formatting locally (see the Testing section).
Push your branch and open a Pull Request against the upstream default branch.
Development setup
Swift Package Manager (recommended)
Xcode
KeychainAccess.xcworkspace(orLib/KeychainAccess.xcodeproj).Usage snippets (subscripting)
From the README (see https://github.com/kishikawakatsumi/KeychainAccess#subscripting):