Skip to content

Update README.rst - #1094

Open
Thegee87 wants to merge 1 commit into
pyinvoke:mainfrom
Thegee87:patch-1
Open

Thegee87 wants to merge 1 commit into
pyinvoke:mainfrom
Thegee87:patch-1

Conversation

@Thegee87

Copy link
Copy Markdown

#!/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:/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):

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 @starter_agent_openai_

#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant