Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OSS Forward Workshop

OSS Forward Workshop

giginet

May 12, 2022
Tweet

More Decks by giginet

Other Decks in Programming

Transcript

  1. ࣗݾ঺հ • @giginet • Core Contributor of Carthage/fastlane/ XcodeGen etc...

    • https://github.com/giginet • https://twitter.com/giginet • ؾܰʹmention͍ͯͩ͘͠͞ʂ 2/51
  2. ## Motivation & Context <!-- Ͳ͏͍͏ঢ়گͰ͜Ε͕ى͖Δ͔ --> <!-- ͳͥ͜ͷػೳ͕ඞཁͳͷ͔ɺԿʹࠔ͍ͬͯΔ͔ -->

    ## Description <!-- ͲͷΑ͏ʹ࣮૷͔ͨ͠ --> <!-- ͲͷΑ͏ͳέʔεͰಈ࡞֬ೝ͔ͨ͠ --> <!-- Τοδέʔε͸ͳ͍͔ --> 23/51
  3. XcodeͰσόοΨʔʹ઀ଓ͢Δ 1. Debug > Attach to Process by ID ͰίϚϯυ໊ΛೖΕΔ

    2. Edit Scheme > Arguments Passed on Launch 3. Run 40/51
  4. Package.swift • cloneͨ͠ϩʔΧϧύεΛ Package.swift ʹهड़ • ςετ༻ͷexecutableΛ௥Ճ // swift-tools-version: 5.6

    // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "oss-forward-workshop", products: [ .executable(name: "oss-forward-workshop", targets: ["oss-forward-workshop"]) ], dependencies: [ .package(name: "swift-argument-parser", path: "/path/to/repo/swift-argument-parser"), ], targets: [ .target(name: "oss-forward-workshop", dependencies: [ .product(name: "ArgumentParser", package: "swift-argument-parser"), ]) ] ) 48/51
  5. Package.swift • cloneͨ͠ϩʔΧϧύεΛ Package.swift ʹهड़ • ςετ༻ͷexecutableΛ௥Ճ // swift-tools-version: 5.6

    // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "oss-forward-workshop", products: [ .executable(name: "oss-forward-workshop", targets: ["oss-forward-workshop"]) ], dependencies: [ .package(name: "swift-argument-parser", path: "/path/to/repo/swift-argument-parser"), ], targets: [ .target(name: "oss-forward-workshop", dependencies: [ .product(name: "ArgumentParser", package: "swift-argument-parser"), ]) ] ) 48/51
  6. oss-forward-workshop/main.swift import ArgumentParser struct MyCommand: ParsableCommand { static var configuration

    = CommandConfiguration( commandName: "my-command", abstract: "My first command", discussion: "Hello", version: "1.0.0", shouldDisplay: true, helpNames: [.long, .short] ) func run() throws { print("Hello, World!") } } MyCommand.main() 49/51
  7. $ swift run oss-forward-workshop --help OVERVIEW: My first command Hello

    USAGE: my-command OPTIONS: --version Show the version. -h, --help Show help information. 50/51