Code Monkey home page Code Monkey logo

Comments (8)

GiselleSerate avatar GiselleSerate commented on September 26, 2024

Create a temp file, pipe in the output from the alias command and grep through it for alias \""$1" at the beginning of each line?

from myaliases.

aryarm avatar aryarm commented on September 26, 2024

Maybe this will help?
It says you can use the unalias command.

from myaliases.

GiselleSerate avatar GiselleSerate commented on September 26, 2024

I reverse engineered this basically xD thanks though, useful suggestions

from myaliases.

GiselleSerate avatar GiselleSerate commented on September 26, 2024

Most relevantly: what should the behavior be in this edge case? Should we:

  • unalias the old command and set the new command? (If so, should we do this explicitly with an unalias in the generated file or silently override it?)
  • check if we set the old command in our generated file and delete that line? Is this even a desired behavior?
  • reject the new command?

from myaliases.

aryarm avatar aryarm commented on September 26, 2024

Since this command is all about convenience, I would have it override the old alias and not reject the new command. I would also check the generated file and delete if necessary. I'm also generally a fan of doing things silently, but we could echo out a statement telling the user that their old alias has been overridden if you want. However, if you do that, you might only want to do it when it's from our generated file so that we can stay true to the original behavior of alias in case any other programs assume that it won't print anything.

from myaliases.

GiselleSerate avatar GiselleSerate commented on September 26, 2024

Oooh, that sounds like a great way to handle it. Currently I have it failing verbosely, but that shouldn't be terrible to implement.
(side note for future me: will involve grep, probably, and a little bit of ed. and much regex.)

from myaliases.

GiselleSerate avatar GiselleSerate commented on September 26, 2024

Currently deletes the old alias silently from .usr_aliases and does nothing otherwise.
This seems to work for for all cases quite well; I'd probably only be worried about order if they try to override a name that someone is already using. Because then inclusion in how things get called from the .bashrc matters a lot as far as what actually gets defined.

from myaliases.

GiselleSerate avatar GiselleSerate commented on September 26, 2024

This happens when I leave projects for a long time; I forget why I haven't closed issues. I'm going to close this, because my previous comments sound pretty resolvey to me?

from myaliases.

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.