Transcript
Page 1: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

stdin,stdoutpup, Go & life at the command-line

Page 2: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 3: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

stdin,stdoutpup, Go & life at the command-line

Page 4: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 5: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ cd ~/talks/codementor$ cat hello.txtHello, Code Mentor!$

Page 6: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 7: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 8: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

CLI life: Data

Page 9: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 10: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 11: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 12: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 13: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 14: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 15: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 16: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 17: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 18: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 19: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 20: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

data

Page 21: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

[LOG] some data[LOG] more data[LOG] even more

Page 22: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

col1,col2,col3some,data,andeven,more,data

Page 23: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

{ “some”: “data”, “more”: “data”}

Page 24: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

<div>

<h1>Some</h1><p>data</p>

</div>

Page 25: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 26: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

grep & nl

Page 27: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 28: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 29: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 30: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 31: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 32: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 33: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 34: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 35: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 36: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

grep

cat

Page 37: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

grep

cat

Page 38: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 39: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 40: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 41: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 42: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

pipes!

Page 43: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ cat Shakespeare.txt | \ sed -e 's/\s+/\n/g' | \ tr -d ' ' | \ grep -e '^$' -v | \ tr '[:upper:]' '[:lower:]' | \ sort | uniq -c | sort -nr | \ head -n 50

Page 44: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ cat Shakespeare.txt | \ sed -e 's/\s+/\n/g' | \ tr -d ' ' | \ grep -e '^$' -v | \ tr '[:upper:]' '[:lower:]' | \ sort | uniq -c | sort -nr | \ head -n 50

Page 45: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ cat Shakespeare.txt | \ sed -e 's/\s+/\n/g' | \ tr -d ' ' | \ grep -e '^$' -v | \ tr '[:upper:]' '[:lower:]' | \ sort | uniq -c | sort -nr | \ head -n 50

Page 46: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ cat Shakespeare.txt | \ sed -e 's/\s+/\n/g' | \ tr -d ' ' | \ grep -e '^$' -v | \ tr '[:upper:]' '[:lower:]' | \ sort | uniq -c | sort -nr | \ head -n 50

Page 47: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ cat Shakespeare.txt | \ sed -e 's/\s+/\n/g' | \ tr -d ' ' | \ grep -e '^$' -v | \ tr '[:upper:]' '[:lower:]' | \ sort | uniq -c | sort -nr | \ head -n 50

Page 48: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ cat Shakespeare.txt | \ sed -e 's/\s+/\n/g' | \ tr -d ' ' | \ grep -e '^$' -v | \ tr '[:upper:]' '[:lower:]' | \ sort | uniq -c | sort -nr | \ head -n 50

Page 49: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ cat Shakespeare.txt | \ sed -e 's/\s+/\n/g' | \ tr -d ' ' | \ grep -e '^$' -v | \ tr '[:upper:]' '[:lower:]' | \ sort | uniq -c | sort -nr | \ head -n 50

Page 50: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ cat Shakespeare.txt | \ sed -e 's/\s+/\n/g' | \ tr -d ' ' | \ grep -e '^$' -v | \ tr '[:upper:]' '[:lower:]' | \ sort | uniq -c | sort -nr | \ head -n 50

Page 51: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ cat Shakespeare.txt | \ sed -e 's/\s+/\n/g' | \ tr -d ' ' | \ grep -e '^$' -v | \ tr '[:upper:]' '[:lower:]' | \ sort | uniq -c | sort -nr | \ head -n 50

Page 52: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 53: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ cat Shakespeare.txt | \ sed -e 's/\s+/\n/g' | \ tr -d ' ' | \ grep -e '^$' -v | \ tr '[:upper:]' '[:lower:]' | \ sort | uniq -c | sort -nr | \ head -n 50

Page 54: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

curl & wget

Page 55: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ wget -O Shakespeare.txt \ http://gutenberg.org/cache/epub/100/pg100.txt

Page 56: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ wget -O Shakespeare.txt \ http://gutenberg.org/cache/epub/100/pg100.txt

Page 57: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ wget -O Shakespeare.txt \ http://gutenberg.org/cache/epub/100/pg100.txt

Page 58: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

wget =

Page 59: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ wget --load-cookies cookies.txt

Page 60: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 61: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 62: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 63: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ wget -O Shakespeare.txt \ http://gutenberg.org/cache/epub/100/pg100.txt

Page 64: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ curl -o Shakespeare.txt \ http://gutenberg.org/cache/epub/100/pg100.txt

Page 65: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ cat Shakespeare.txt | \ sed -e 's/\s+/\n/g' | \ tr -d ' ' | \ grep -e '^$' -v | \ tr '[:upper:]' '[:lower:]' | \ sort | uniq -c | sort -nr | \ head -n 50

Page 66: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ curl http://gutenberg.org... | \ sed -e 's/\s+/\n/g' | \ tr -d ' ' | \ grep -e '^$' -v | \ tr '[:upper:]' '[:lower:]' | \ sort | uniq -c | sort -nr | \ head -n 50

Page 67: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

curl & wget

Page 68: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

curl & wget

Page 69: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 70: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

I hate HTML

Page 71: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

HTML is really hard

Page 72: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 73: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

“Every time you attempt to parse HTML with regular expressions, the unholy child weeps the blood of virgins, and Russian hackers pwn your webapp.”

Page 74: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

“Have you tried using an XML parser instead?”

Page 75: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

But it gets worse

Page 76: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

<tbody> <tr><img src="foo"></tr> <tr><img/><br> </tbody></table>

Page 77: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

<tbody> <tr><img src="foo"></tr> <tr><img/><br> </tbody></table>

Yes, this is valid HTML:

Page 78: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

<tbody> <tr><img src="foo"></tr> <tr><img/><br> </tbody></table>

Yes, this is valid HTML:

Page 79: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

<tbody> <tr><img src="foo"></tr> <tr><img/><br> </tbody></table>

Yes, this is valid HTML:

Page 80: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

<tbody> <tr><img src="foo"></tr> <tr><img/><br> </tbody></table>

Yes, this is valid HTML:

Page 81: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 82: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 83: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

NEVER TRY TO WRITE AN HTML PARSER

Page 84: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

Nokogiri 鋸

Page 85: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 86: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 87: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

pup

Page 88: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 89: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 90: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 91: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 92: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 93: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 94: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 95: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 96: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 97: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 98: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 99: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 100: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 101: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 102: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 103: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 104: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 105: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 106: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 107: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

Still HTML

Page 108: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 109: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 110: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 111: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ curl -L -s reddit.com/r/programming/ | \ pup p.title a[href^=http] attr{href}

$ curl -s https://news.ycombinator.com/ | \ pup td.title a[href^=http] attr{href}

Page 112: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ curl -L -s reddit.com/r/programming/ | \ pup p.title a[href^=http] attr{href}

$ curl -s https://news.ycombinator.com/ | \ pup td.title a[href^=http] attr{href}

Page 113: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ curl -L -s reddit.com/r/programming/ | \ pup p.title a[href^=http] attr{href}

$ curl -s https://news.ycombinator.com/ | \ pup td.title a[href^=http] attr{href}

Page 114: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ curl -L -s reddit.com/r/programming/ | \ pup p.title a[href^=http] attr{href}

$ curl -s https://news.ycombinator.com/ | \ pup td.title a[href^=http] attr{href}

Page 115: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ curl -s https://news.ycombinator.com/ | \ pup td.title a[href^=http] json{}[ { "attrs": { "href": "https://hacks.mozilla.org/2014/10/passwordless-authentication-secure-simple-and-fast-to-deploy/" }, ...]

Page 116: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ curl -s https://news.ycombinator.com/ | \ pup td.title a[href^=http] json{}[ { "attrs": { "href": "https://hacks.mozilla.org/2014/10/passwordless-authentication-secure-simple-and-fast-to-deploy/" }, ...]

Page 117: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ curl -s https://news.ycombinator.com/ | \ pup td.title a[href^=http] json{}[ { "attrs": { "href": "https:.../" }, "tag": "a", "text": "SHOW HN: pup" }, ...]

Page 118: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

github.com/EricChiang/pup

Page 119: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

Part II: Building CLI tools in Go

Page 120: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

import java.util.Scanner;

class Hello { public static void main(String[] args) { Scanner reader = new Scanner(System.in); System.out.print("Enter your name: "); String name = reader.nextLine(); System.out.printf("Hello, "+name+"!"); }}

Page 121: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 122: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

import java.util.Scanner;

class Hello { public static void main(String[] args) { Scanner reader = new Scanner(System.in); System.out.print("Enter your name: "); String name = reader.nextLine(); System.out.printf("Hello, "+name+"!"); }}

Page 123: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

import java.util.Scanner;

class Hello { public static void main(String[] args) { Scanner reader = new Scanner(System.in); System.out.print("Enter your name: "); String name = reader.nextLine(); System.out.printf("Hello, "+name+"!"); }}

Page 124: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 125: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

import java.util.Scanner;

class Hello { public static void main(String[] args) { Scanner reader = new Scanner(System.in); System.out.print("Enter your name: "); String name = reader.nextLine(); System.out.printf("Hello, "+name+"!"); }}

Page 126: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 127: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 128: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

Why Go?

Page 129: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

Why not?

Page 130: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

Taken from Rob Pike’s talk public static void main (2012)

Page 131: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

Taken from Rob Pike’s talk public static void main (2012)

“dear god make it stop”

Page 132: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

Why not?

Page 133: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

Why not?

Page 134: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

I suck at this -->

Page 135: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 136: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

Go

Page 137: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

package main

import "fmt"

func main() {fmt.Println("Hello, world!")

}

Page 138: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

line

Page 139: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

package main

import "io"import "os"

func main() {io.Copy(os.Stdout, os.Stdin)io.WriteString(os.Stdout, "\n")

}

Page 140: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

package main

import "io"import "os"

func main() {io.Copy(os.Stdout, os.Stdin)io.WriteString(os.Stdout, "\n")

}

Page 141: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

package main

import "io"import "os"

func main() {io.Copy(os.Stdout, os.Stdin)io.WriteString(os.Stdout, "\n")

}

Page 142: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

package main

import "io"import "os"

func main() {io.Copy(os.Stdout, os.Stdin)io.WriteString(os.Stdout, "\n")

}

Page 143: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

package main

import "io"import "os"

func main() {io.Copy(os.Stdout, os.Stdin)io.WriteString(os.Stdout, "\n")

}

Page 144: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ echo "Hello, World"Hello, World

Page 145: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ echo "Hello, World"Hello, World$ go get github.com/ericchiang/line

Page 146: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

$ echo "Hello, World"Hello, World$ go get github.com/ericchiang/line$ echo "Hello, World" | lineHello, World

$

Page 147: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

url-encode

Page 148: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

Live demo!

Page 149: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

gox

Page 150: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 151: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

Messing with zip

Page 152: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 153: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 154: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 155: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 156: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 157: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line
Page 158: Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at the command-line

Thanks!


Recommended