kieraneglin / encrypted_secrets_ex

Store your application's secrets inside your VCS
MIT License
46 stars 5 forks source link

Detect presence of an editor #5

Open azuby opened 5 years ago

azuby commented 5 years ago

First off, great work on putting together your first package and thank you for putting it together!

It would be great to have a simple check to ensure you have an editor available from the CLI, and instructions on how to do so if one isn't present. The error is somewhat convoluted if you attempt to open the secrets without an editor:

$ EDITOR='code --wait' mix EncryptedSecrets.Edit
** (ErlangError) Erlang error: :enoent
    (elixir) lib/system.ex:791: System.cmd("code", ["--wait", "priv/secrets/secrets_tmp_83FECEA52E179DB3.yml"], [])
    lib/encrypted_secrets.ex:63: EncryptedSecrets.edit/2
    lib/mix/tasks/encrypted_secrets/edit.ex:12: Mix.Tasks.EncryptedSecrets.Edit.run/1
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:79: Mix.CLI.run_task/2

Setting up and editor is as simple as running the following on MacOS: ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime