1. 4

    why not use

    $ some –command; osascript -e ‘display notification “Done!!” with title “Done!”’

    on your mac? (there are equivalents for gnome, kde, X etc.)

    1. 6

      This is actually superior because, I’m guessing, aa probably won’t work with things like shell aliases, so simply using the shell to run your alert after the command finishes is a better option.

      1. 2

        Good point! I forgot about shell aliases. I opened an issue to track adding support for that:

        https://github.com/frewsxcv/alert-after/issues/8

        1. 1

          One option would be to just always run the command through the user’s shell. Yours isn’t the only otherwise-cool utility that doesn’t work on aliases. I recently found https://github.com/chneukirchen/nq and was super stoked until I realized it barfed on aliases. I may submit a PR to support that if I find time.

          How do you like Rust? I haven’t found enough time or motivation to wrap my tiny brain around it yet :-(

      2. 3

        I don’t think alert-after actually does this yet, but one advantage of using a wrapper is that it can check the exit status and automatically give you a success/failure notification. You could do that in shell too, but it’d be much more tedious to write out by hand every time.

        1. 5
          some --command && osascript -e 'display notification "Success!!"' || osascript -e 'display notification "Failure!!"'
          

          Not awful.

          1. 1

            If you simply want to notify with the exit code you can use $? which is bound the exit code of the previous process, e.g.

            bash -c "exit 0";  echo Status: $?
            
            1. 0

              A 101-character suffix on a command, versus the OP’s 2-character prefix on a command? Yes, I’d call that “much more tedious”.

              (it would be pretty easy to turn your command into a shell-script wrapper with a two-character name, but that’s just an argument about implementation, not about whether a wrapper is a good design)

            2. 4

              sure, but it could be a 5 line shell script

              1. 1

                shell has functions and aliases that you can add to your profile.

              2. 1

                I use zenity on Linux for this exact purpose