Giter VIP home page Giter VIP logo

Comments (6)

eradman avatar eradman commented on May 9, 2024 1

I agree with @iamleot that a script it usually the most strait-forward thing to do:

git ls-files | entr ./build.sh

This is worth it even for a one-line script because when you cd to the directory it's obvious what to do. Thanks for posting your solution as well! Closing

from entr.

iamleot avatar iamleot commented on May 9, 2024

Hello @nicola-lunghi!
Probably the easiest way is just using a script instead of having an alias.

from entr.

nicola-lunghi avatar nicola-lunghi commented on May 9, 2024

Hi I just found that I can do

git ls-files | entr sh -c "${BASH_ALIASES[my_cmd]}"

In bash > 4.0

:-)

from entr.

nielsbom avatar nielsbom commented on May 9, 2024

I use quite a lot of aliases, having entr be able to use them directly would be very comfortable.

I don't know how to write C, but I'm interested to know how/why this was not implemented. Are aliases special or difficult in some ways?

Could I write a PR to enable this functionality? Would you accept such a PR @eradman ?

from entr.

eradman avatar eradman commented on May 9, 2024

Aliases are special because they're not part of the environment, they're a feature of the shell. This means entr can't inherit or inject them.

@nielsbom it's good that you brought this back up because there is a simple we can do, namely run shell with the login -l flag:

... | entr sh -l -c "..."

Each shell is different, but here is the relevant part from the bash(1) man page

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

Another option is to source a file that defines aliases directly

... | entr sh -c ". ./profile; ..."

from entr.

eradman avatar eradman commented on May 9, 2024

Closing since the use of shell aliases it outside the scope of what entr should or can take responsibility for.

As noted, files can be sourced manually

... | entr -s '. .myenv.sh; ...'

from entr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.