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
Building CLI with Swift
Search
Oleksandr Voronov
March 19, 2016
Programming
1
310
Building CLI with Swift
https://youtu.be/5h-l_ou95_o
Oleksandr Voronov
March 19, 2016
Tweet
Share
More Decks by Oleksandr Voronov
See All by Oleksandr Voronov
Controllable Randomness in Unit Tests
alexandervoronov
1
37
Modularizing your iOS apps
alexandervoronov
0
120
TDD in Real World
alexandervoronov
1
210
Stanfy MadCode 10: From Java to Kotlin, from Objective-C to Swift
alexandervoronov
0
220
Alexander Voronov
alexandervoronov
2
1.2k
ReactiveCocoa
alexandervoronov
0
140
Other Decks in Programming
See All in Programming
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
860
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.7k
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
330
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
Featured
See All Featured
Teambox: Starting and Learning
jrom
133
8.8k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Rails Girls Zürich Keynote
gr2m
94
13k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Bash Introduction
62gerente
608
210k
Building Your Own Lightsaber
phodgson
103
6.1k
Become a Pro
speakerdeck
PRO
25
5k
Code Review Best Practice
trishagee
64
17k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Transcript
IT Saturday • @aleks_voronov • Stanfy BUILDING CLI WITH SWIFT
ALEXANDER VORONOV, STANFY @aleks_voronov
IT Saturday • @aleks_voronov • Stanfy REASON WHY?
IT Saturday • @aleks_voronov • Stanfy OTHER PLATFORMS
IT Saturday • @aleks_voronov • Stanfy JAVASCRIPT NODEJS NPM BOWER
GULP GRUNT
IT Saturday • @aleks_voronov • Stanfy RUBY RACK RAILS SINATRA
RUBYGEMS RAKE
IT Saturday • @aleks_voronov • Stanfy PYTHON PYPI PIP …
IT Saturday • @aleks_voronov • Stanfy SWIFT COCOAPODS CARTHAGE SPM
PERFECT COMMANDANT
IT Saturday • @aleks_voronov • Stanfy FULLSTACK MULTIPLATFORM
IT Saturday • @aleks_voronov • Stanfy FULLSTACK MULTIPLATFORM
IT Saturday • @aleks_voronov • Stanfy WHAT IS CLI?
IT Saturday • @aleks_voronov • Stanfy WHAT IS CLI?
IT Saturday • @aleks_voronov • Stanfy CLI ARGUMENTS
IT Saturday • @aleks_voronov • Stanfy POSIX STANDARD SHORT FLAGS
$ ls -a $ ruby -v $ git commit -m "..."
IT Saturday • @aleks_voronov • Stanfy GNU STANDARD LONG FLAGS
$ ls --all $ ruby --version $ git commit --message "..."
IT Saturday • @aleks_voronov • Stanfy COMBINED FLAGS $ git
commit -a -m "..." $ git commit -am "..."
IT Saturday • @aleks_voronov • Stanfy SUBCOMMANDS $ git log
-2 $ git status $ git commit -am "..."
IT Saturday • @aleks_voronov • Stanfy STANDARD IO 0 -
STDIN 1 - STDOUT 2 - STDERR
IT Saturday • @aleks_voronov • Stanfy 0 - STDIN 1
- STDOUT 2 - STDERR $ cat nofile > cat: nofile: No such file or directory
IT Saturday • @aleks_voronov • Stanfy 0 - STDIN 1
- STDOUT 2 - STDERR $ cat nofile 2>>err.log
IT Saturday • @aleks_voronov • Stanfy 0 - STDIN 1
- STDOUT 2 - STDERR $ cat nofile 2>&1
IT Saturday • @aleks_voronov • Stanfy 0 - STDIN 1
- STDOUT 2 - STDERR $ cat nofile 2>>err.log 1>>out.log
IT Saturday • @aleks_voronov • Stanfy 0 - STDIN 1
- STDOUT 2 - STDERR $ cat nofile 2>/dev/null
IT Saturday • @aleks_voronov • Stanfy 0 - STDIN 1
- STDOUT 2 - STDERR $ cat nofile 2>&1 | grep kernel
IT Saturday • @aleks_voronov • Stanfy UNIX PIPELINES ⛓ $
ls -l | grep "Mar" | sort
IT Saturday • @aleks_voronov • Stanfy UNIX PIPELINES ⛓ $
ps aux | grep Xcode | awk '{print $2}'
IT Saturday • @aleks_voronov • Stanfy UNIX PIPELINES ⛓ $
git branch | xargs git branch -D
IT Saturday • @aleks_voronov • Stanfy CLI WITH SWIFT
IT Saturday • @aleks_voronov • Stanfy SWIFT REPL (READ-EVALUATION-PRINT-LOOP) $
swift
IT Saturday • @aleks_voronov • Stanfy IMMEDIATE MODE $ swift
script.swift
IT Saturday • @aleks_voronov • Stanfy SWIFT COMPILE ⚙ $
swiftc script.swift $ ./script
IT Saturday • @aleks_voronov • Stanfy SWIFT COMPILE ⚙ $
swiftc script.swift -o myscript $ ./myscript
IT Saturday • @aleks_voronov • Stanfy EXECUTABLE SCRIPTS
IT Saturday • @aleks_voronov • Stanfy EXECUTABLE SCRIPTS #!/USR/BIN/SWIFT HASHBANG
IT Saturday • @aleks_voronov • Stanfy EXECUTABLE SCRIPTS CHMOD +X
SCRIPT.SWIFT
IT Saturday • @aleks_voronov • Stanfy SCALING OUR CLI WORKING
WITH MULTIPLE FILES
IT Saturday • @aleks_voronov • Stanfy MAIN.SWIFT
IT Saturday • @aleks_voronov • Stanfy EXECUTING MULTIPLE FILES $
swift main.swift script.swift
IT Saturday • @aleks_voronov • Stanfy $ swiftc main.swift script.swift
-o script EXECUTING MULTIPLE FILES
IT Saturday • @aleks_voronov • Stanfy $ swiftc script.swift main.swift
-o script EXECUTING MULTIPLE FILES
IT Saturday • @aleks_voronov • Stanfy $ swiftc *.swift -o
script EXECUTING MULTIPLE FILES
IT Saturday • @aleks_voronov • Stanfy $ find . -iname
'*.swift' | xargs swiftc -o script EXECUTING MULTIPLE FILES
IT Saturday • @aleks_voronov • Stanfy EXTERNAL RESOURCES
IT Saturday • @aleks_voronov • Stanfy SYSTEM DEPENDENCIES $ swiftc
script.swift $ xcrun -sdk macosx swiftc script.swift
IT Saturday • @aleks_voronov • Stanfy CUSTOM DEPENDENCIES -F $
swift -F /Carthage/Build/Mac script.swift
IT Saturday • @aleks_voronov • Stanfy CUSTOM DEPENDENCIES #!/USR/BIN/SWIFT -F
Carthage/Build/Mac HASHBANG
IT Saturday • @aleks_voronov • Stanfy COMPILING DEPENDENT SCRIPT
IT Saturday • @aleks_voronov • Stanfy $ xcrun \ -sdk
macosx swiftc \ -F Carthage/Build/Mac script.swift COMPILING DEPENDENT SCRIPT > dyld: Library not loaded: @rpath
IT Saturday • @aleks_voronov • Stanfy $ xcrun \ -sdk
macosx swiftc \ -F Carthage/Build/Mac script.swift \ -Xlinker -rpath \ -Xlinker @executable_path/Carthage/Build/Mac COMPILING DEPENDENT SCRIPT
IT Saturday • @aleks_voronov • Stanfy DEPENDENCIES MANAGEMENT
IT Saturday • @aleks_voronov • Stanfy COCOAPODS
IT Saturday • @aleks_voronov • Stanfy CARTHAGE
IT Saturday • @aleks_voronov • Stanfy SPM SWIFT PACKAGE MANAGER
IT Saturday • @aleks_voronov • Stanfy PARSING ARGUMENTS
IT Saturday • @aleks_voronov • Stanfy PARSING ARGUMENTS $ ./script
one two three $ ./script one\ two\ three $ ./script "one two three" 3 args 1 arg 1 arg
IT Saturday • @aleks_voronov • Stanfy PROCESS ENUM Process.arguments ==
[ "./script.swift", "one", "two", "three" ]
IT Saturday • @aleks_voronov • Stanfy FILESYSTEM
IT Saturday • @aleks_voronov • Stanfy FILESYSTEM NSFILEMANAGER NSFILEHANDLER NSTASK
NSPIPE
IT Saturday • @aleks_voronov • Stanfy HANDY LIBRARIES COMMANDER OPTIONKIT
COMMANDANT REACTIVETASKS PRETTYCOLORS
IT Saturday • @aleks_voronov • Stanfy REAL WORLD EXAMPLES CARTHAGEKIT
CARTHAGE CLI
IT Saturday • @aleks_voronov • Stanfy THANK YOU!
IT Saturday • @aleks_voronov • Stanfy Q/A @ALEKS_VORONOV A-VORONOV