Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
jq at the Shortcuts
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
cockscomb
December 22, 2022
Programming
1
2k
jq at the Shortcuts
Presented @ potatotips#80
cockscomb
December 22, 2022
Tweet
Share
More Decks by cockscomb
See All by cockscomb
GraphQL放談
cockscomb
4
2.1k
GraphQL Highway
cockscomb
28
8.7k
吉田を支える技術
cockscomb
0
2.4k
コーポレートサイトを静的化してAmplify Consoleにデプロイする
cockscomb
0
3.4k
ユーザインターフェイスと非同期処理
cockscomb
5
2k
GUIアプリケーションの構造と設計
cockscomb
10
10k
イカリング2におけるシングルページアプリケーション
cockscomb
2
7.6k
あなたの知らない UIKit の世界 — UITableView に UITextView を置きたい
cockscomb
1
7.6k
iOSアプリエンジニアのためのAndroidアプリ開発
cockscomb
7
2k
Other Decks in Programming
See All in Programming
Patterns of Patterns
denyspoltorak
0
1.3k
AgentCoreとHuman in the Loop
har1101
5
220
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
120
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
980
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
180
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
1
1.1k
AIエージェントの設計で注意するべきポイント6選
har1101
7
3.4k
CSC307 Lecture 09
javiergs
PRO
1
810
Vibe codingでおすすめの言語と開発手法
uyuki234
0
220
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
590
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
390
Featured
See All Featured
ラッコキーワード サービス紹介資料
rakko
1
2.2M
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.5k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
52
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
89
A Modern Web Designer's Workflow
chriscoyier
698
190k
The World Runs on Bad Software
bkeepers
PRO
72
12k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
270
Deep Space Network (abreviated)
tonyrice
0
44
For a Future-Friendly Web
brad_frost
182
10k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
400
Transcript
.app jq
id:cockscomb
jq
jq stedolan.github.io/jq/ $ echo '{"foo": "bar"}' | jq '.foo' "bar"
gh Scripting with GitHub CLI | The GitHub Blog $
gh api ... -- jq '.[].login' # = > "user1" # = > "user2" # = > ...
jq JSON
.app
URL
None
jq
Swift jq
gojq itchyny/gojq: Pure Go implementation of jq
golang.org/x/mobile
package binding import ( "github.com/itchyny/gojq" _ "golang.org/x/mobile/bind" ) type Query
struct { query *gojq.Query } func NewQuery(src string) (*Query, error) { query, err := gojq.Parse(src) if err != nil { return nil, err } return &Query{query: query}, nil } func (q *Query) Run(input []byte) (*Iterator, error) { ... }
$ gomobile bind \ -target=ios,iossimulator,macos,maccatalyst \ -iosversion 14 \ -prefix
GOJQ \ -o Frameworks/GOJQBinding.xcframework \ github.com/cockscomb/swift-gojq/binding
import Foundation open class GOJQBindingIterator : NSObject, goSeqRefInterface { public
init() open func next() throws -> Data } open class GOJQBindingQuery : NSObject, goSeqRefInterface { public init?(_ src: String?) open func run(_ input: Data?) throws -> GOJQBindingIterator } public func GOJQBindingNewQuery(_ src: String?, _ error: NSErrorPointer) -> GOJQBindingQuery?
import GOJQBinding enum QueryError: Error { case unknown } public
struct Query { private let binding: GOJQBindingQuery public init(_ query: String) throws { var error: NSError? guard let binding = GOJQBindingNewQuery(query, &error) else { throw error ?? QueryError.unknown } self.binding = binding } public func run(_ input: Data) throws -> AsyncThrowingStream<Data, any Error> { ... } }
None
// swift-tools-version: 5.7 import PackageDescription let package = Package( name:
"SwiftGoJq", platforms: [ .macOS(.v13), .macCatalyst(.v14), .iOS(.v14) ], products: [ .library(name: “SwiftGoJq”, targets: ["SwiftGoJq"]), ], dependencies: [], targets: [ .binaryTarget( name: "GOJQBinding", url: "https://github.com/cockscomb/swift-gojq/releases/download/0.1.0/ GOJQBinding.xcframework.zip", checksum: "1c45710de17fb7020dcfc75105344729725c5e3875e7058e98790e5f4e178162"), .target( name: "SwiftGoJq", dependencies: [ "GOJQBinding", ]), ] )
cockscomb/swift-gojq
None
import AppIntents import AsyncAlgorithms import SwiftGoJq struct JQIntent: AppIntent {
static var title: LocalizedStringResource = "jq" @Parameter(title: "JSON") var input: String @Parameter(title: "Query") var query: String static var parameterSummary: some ParameterSummary { Summary("\(\.$input) | jq '\(\.$query)'") } func perform() async throws -> some IntentResult { let jq = try Query(query) let results = try jq.run(input) let array = try await Array(results) return .result(value: array) } }
None
None
WEB+DB PRESS vol. 1 3 2 iOS 1 6 12/24
3 id:cockscomb id:yutailang 01 19 id:kouki_dan