jonasbn / macaliaser

script for building bash aliases for applications on MacOS
https://jonasbn.github.io/macaliaser/
Artistic License 2.0
2 stars 0 forks source link

Issue with Docker.app and alias when running from cron #7

Closed jonasbn closed 6 years ago

jonasbn commented 6 years ago

Issue Template

Description

Issue with Docker.app and alias when running from cron. I am pondering if the issue is based on insufficient $PATH definition.

Bugs and Issues

Specify what version was used

Version based on master from GitHub, as of 2018-03-01 (and earlier).

Supply some information on the environment

Please provide some information on your Perl interpreter.

> perl -v

This is perl 5, version 18, subversion 2 (v5.18.2) built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)

Copyright 1987-2013, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

 ¯\_(ツ)_/¯  [jonasbn:~] $ 

Expected behaviour

What behaviour did you expect?

I would expect docker to preserved as the command line tool and the Docker.app would be aliased as dockerapp

Actual and observed behaviour

What behaviour did you observe?

The suggested alias shadows the command line tool docker

> alias docker
alias docker='open -a /Applications/Docker.app'
 ¯\_(ツ)_/¯  [jonasbn:~] $ 

Steps to reproduce the behaviour

A test, script or one-liner is preferred, but anything that can help is good

$ crontab -l
0   10  *   *   *   /Users/jonasbn/bin/macaliaser -i /Applications /Users/jonasbn/Applications > /Users/jonasbn/.aliases
jonasbn commented 6 years ago

If the issue is in the cron setup, this is not a bug in macaliaser, but it should be addressed in the documentation any how.

jonasbn commented 6 years ago

The problem is that users $PATH is not know to the job is running under cron. There is more that one way to address the issue. I settled for:

. $HOME/.bash_profile; /Users/jonasbn/bin/macaliaser -i /Applications /Users/jonasbn/Applications > /Users/jonasbn/.aliases

Solution provided by Stack Overflow.

Documentation will be updated accordingly.