Skip to content

Detect presence of an editor #5

@azuby

Description

@azuby

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions