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

Treat your CLI like an API

Rob
July 27, 2016

Treat your CLI like an API

Applying the developer-friendly attributes of APIs to your command line interfaces will increase adoption of your software, make it easier to update over time, and build trust in your business.

Rob

July 27, 2016
Tweet

More Decks by Rob

Other Decks in Design

Transcript

  1. UX = Adoption = Revenue Embedded in a dev workflow

    But, devs need to trust it first
  2. $ rkt run ubuntu $ rkt run \ --insecure-options=none \

    --trust-keys-from-https=false \ ubuntu
  3. $ rkt run --insecure-skip-verify \ ubuntu $ rkt run --insecure-options=image

    \ ubuntu $ rkt run \ --insecure-options=image,http,pubkey \ ubuntu
  4. Scripting against a CLI should always be possible This is

    a hidden API contract CLI/API CONTRACT
  5. $ kubectl get pods NAME READY STATUS RESTARTS AGE etcd-torus

    1/1 Running 0 1d installer-prototype-sksfg 1/1 Running 0 13d nginx-router-lhdy6 1/1 Running 0 13d sidenav-prototype-gffv1 1/1 Running 0 6d tectonic-console-sd0rr 1/1 Running 0 13d torus-5mo0j 1/1 Running 0 1d torus-n4sji 1/1 Running 0 1d torus-p8c4z 1/1 Running 0 1d $ kubectl get pods | grep nginx | tr -s ' ' | cut -d ' ' -f 1 nginx-router-lhdy6
  6. 12:21:47 Starting etcd2... 12:21:47 recognized and used environment variable ETCD_ADVERTISE_CLIENT_URLS=http://10.0.0.50:

    2379 12:21:47 recognized and used environment variable ETCD_DATA_DIR=/var/lib/etcd2 12:21:47 recognized and used environment variable ETCD_ELECTION_TIMEOUT=1200 12:21:47 recognized and used environment variable ETCD_INITIAL_ADVERTISE_PEER_URLS=http://10. 0.0.50:2380 12:21:47 recognized and used environment variable ETCD_INITIAL_CLUSTER=controller=http://10. 0.0.50:2380 12:21:47 recognized and used environment variable ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 12:21:47 recognized and used environment variable ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 12:21:47 unrecognized environment variable ETCD_NAEM=controller 12:21:47 etcd Version: 2.3.2 12:21:47 Git SHA: ce63f10 12:21:47 Go Version: go1.5.4 12:21:47 Go OS/Arch: linux/amd64 12:21:47 setting maximum number of CPUs to 1, total number of available CPUs is 1 12:21:47 the server is already initialized as member before, starting as etcd member... 12:21:47 listening for peers on http://0.0.0.0:2380 12:21:47 listening for client requests on http://0.0.0.0:2379 12:21:48 recovered store from snapshot at index 8240824
  7. 12:21:47 Starting etcd2... 12:21:47 recognized and used environment variable ETCD_ADVERTISE_CLIENT_URLS=http://10.0.0.50:

    2379 12:21:47 recognized and used environment variable ETCD_DATA_DIR=/var/lib/etcd2 12:21:47 recognized and used environment variable ETCD_ELECTION_TIMEOUT=1200 12:21:47 recognized and used environment variable ETCD_INITIAL_ADVERTISE_PEER_URLS=http://10. 0.0.50:2380 12:21:47 recognized and used environment variable ETCD_INITIAL_CLUSTER=controller=http://10. 0.0.50:2380 12:21:47 recognized and used environment variable ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 12:21:47 recognized and used environment variable ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 12:21:47 unrecognized environment variable ETCD_NAEM=controller 12:21:47 etcd Version: 2.3.2 12:21:47 Git SHA: ce63f10 12:21:47 Go Version: go1.5.4 12:21:47 Go OS/Arch: linux/amd64 12:21:47 setting maximum number of CPUs to 1, total number of available CPUs is 1 12:21:47 the server is already initialized as member before, starting as etcd member... 12:21:47 listening for peers on http://0.0.0.0:2380 12:21:47 listening for client requests on http://0.0.0.0:2379 12:21:48 recovered store from snapshot at index 8240824
  8. $ kubectl create -f nginx.yaml Created pod nginx-router-lhdy6 $ docker

    run -d ubuntu a736b91c5bd9627671d4fe952103b1422cc123ce40ded73703184577730fce10 $ etcdctl member add infra3 http://10.0.1.13:2380 added member 9bf1b35fc7761a23 to cluster ETCD_NAME="infra3" ETCD_INITIAL_CLUSTER="infra0=http://10.0.1.10:2380,infra1=http: //10.0.1.11:2380,infra2=http://10.0.1.12:2380,infra3=http://10. 0.1.13:2380" ETCD_INITIAL_CLUSTER_STATE=existing
  9. $ preso -h Usage: preso [flags] preso [command] Available Commands:

    add-slide apply-template delete-slide make-template present
  10. $ preso -h Usage: preso [flags] preso [command] [subcommand] Available

    Commands: slide present template Use "preso [command] --help" for info about a command.