Skip to content

Commit

Permalink
docs: add usage to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-seongwoo-jun committed Dec 26, 2023
1 parent bdc5dca commit 07d5716
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@

JSON files for mapping iOS, iPadOS, tvOS, watchOS, and macOS device identifiers to some human readable equivalent.

## Usage

You can download JSON files from the repository.

```shell
curl https://raw.githubusercontent.com/kyle-seongwoo-jun/apple-device-identifiers/main/ios-device-identifiers.json > ios-device-identifiers.json
```

Here is a simple example using the JSON file with bash and [jq](https://stedolan.github.io/jq/).

```shell
function get_apple_device_name() {
local URL="https://raw.githubusercontent.com/kyle-seongwoo-jun/apple-device-identifiers/main"
local OS="$1" # ios, tvos, watchos, mac
local IDENTIFIER="$2"
curl "$URL/$OS-device-identifiers.json" | jq -r ".[\"$IDENTIFIER\"]"
}

$ get_apple_device_name ios iPhone16,1
iPhone 15 Pro

$ get_apple_device_name mac Mac15,11
MacBook Pro (16-inch, Nov 2023)
```

## Genrerate JSON file

```shell
Expand Down

0 comments on commit 07d5716

Please sign in to comment.