digdagコマンドが fish 互換無かったときにしたこと

仕事で [digdag](https://www.digdag.io/) を使う機会があった。
その当時はデフォルトで fish サポートしてくれておらず悲しい気持ちになった。

### digdag インストール

以下、[digdag.io](http://docs.digdag.io/getting_started.html)より抜粋
※環境変数を設定する3つめのコマンドは fish 仕様に修正してある

``` bash
$ curl -o ~/bin/digdag --create-dirs -L "https://dl.digdag.io/digdag-latest"
$ chmod +x ~/bin/digdag
$ echo 'set -gx PATH $HOME/bin $PATH' >> ~/.config/fish/config.fish
```

### 叩いてみると

``` bash
$ digdag -v
Failed to execute process '/Users/xyxyxy/bin/digdag'. Reason:
exec: Exec format error
The file '/Users/xyxyxy/bin/digdag' is marked as an executable but could not be run by the operating system.
```

このオペレーティングシステムでは動かないとのこと...

### fish を退出して実行

``` bash
$ digdag -v
2017-10-18 18:58:34 +0900: Digdag v0.9.20
Usage: digdag <command> [options...]
  Local-mode commands:
    init <dir>                         create a new workflow project
    r[un] <workflow.dig>               run a workflow
    c[heck]                            show workflow definitions
    sched[uler]                        run a scheduler server
    selfupdate                         update cli to the latest version

  Server-mode commands:
    server                             start server

  Client-mode commands:
    push <project-name>                create and upload a new revision
    download <project-name>            pull an uploaded revision
    start <project-name> <name>        start a new session attempt of a workflow
    retry <attempt-id>                 retry a session
    kill <attempt-id>                  kill a running session attempt
    backfill <project-name> <name>     start sessions of a schedule for past times
    reschedule                         skip sessions of a schedule to a future time
    log <attempt-id>                   show logs of a session attempt
    workflows [project-name] [name]    show registered workflow definitions
    schedules                          show registered schedules
    disable <schedule-id>              disable a workflow schedule
    disable <project-name>             disable all workflow schedules in a project
    disable <project-name> <name>      disable a workflow schedule
    enable <schedule-id>               enable a workflow schedule
    enable <project-name>              enable all workflow schedules in a project
    enable <project-name> <name>       enable a workflow schedule
    sessions                           show sessions for all workflows
    sessions <project-name>            show sessions for all workflows in a project
    sessions <project-name> <name>     show sessions for a workflow
    session  <session-id>              show a single session
    attempts                           show attempts for all sessions
    attempts <session-id>              show attempts for a session
    attempt  <attempt-id>              show a single attempt
    tasks <attempt-id>                 show tasks of a session attempt
    delete <project-name>              delete a project
    secrets --project <project-name>   manage secrets
    version                            show client and server version

  Options:
    -L, --log PATH                   output log messages to a file (default: -)
    -l, --log-level LEVEL            log level (error, warn, info, debug or trace)
    -X KEY=VALUE                     add a performance system config
    -c, --config PATH.properties     Configuration file (default: /Users/xyxyxy/.config/digdag/config)

Use `<command> --help` to see detailed usage of a command.
```

動く。

### bash からコマンドを叩ければ問題ないらしい
```bash
$ echo "alias digdag '/bin/bash ~/bin/digdag'" >> ~/.config/fish/config.fish
```

解決。

余談だけど最新のバージョンでは改善されてるみたい。
https://github.com/treasure-data/digdag/issues/426