JanDeDobbeleer / aliae

Cross shell and platform alias management
https://aliae.dev
MIT License
73 stars 3 forks source link

Existance check of a file #60

Closed trajano closed 7 months ago

trajano commented 8 months ago

Code of Conduct

What would you like to see changed/added?

Something like

ssh-agent: 
  enabled: true

which maps to something along the lines of

script:
  - value: |
      eval $( ssh-agent )
  - if: 
      - ssh-agent executable is available
      - SSH_AUTH_SOCK env var is not set

Other options

ssh-agent: 
  force: true # ignore existing env var
  executables:  # override executable
    - executable: /opt/my/ssh-agent
       if: 
         - os == darwin etc.
    - executable: ssh-agent # default since it has no `if` may be omitted
JanDeDobbeleer commented 8 months ago

@trajano I would add this to the script functionality instead of creating a specific section. Because that won't scale. You can already validate for environment variables using env "SSH_AUTH_SOCK" in the template (and if statement), all you need is the ability to check for an executable. That said, we do have a catch 22. If you also add the PATH entry for the executable's location to the aliae config, we can't validate if we can find it unless we first export that internally as well, I will have to check if we can make that work.

script:
  - value: |
      eval $( ssh-agent )
  - if:  and (env "SSH_AUTH_SOCK") (exists ssh-agent)
trajano commented 8 months ago

Well we can evaluate path first and then do a internal path scan in aliae to check if it is executable.