Jump to content

basecalc: A programmers calculator for Alfred


themadsens
 Share

Recommended Posts

basecalc

A programmers calculator for Alfred

 

Evaluates a Lua (v5.4) numeric expression and displays the result in the four main bases. Everything from the Lua math library is available, and in addition log10() and e

 

In addition to decimal (42) and hexadecimal (0x2a), binary (0b101010) and octal (0o52) notation is available.

Uses '=' as the trigger keyword. Make sure to disable '=' for the built in calculator in Alfred Preferences/Features/Calculator.

 

Requires: Lua version 5.4

brew install lua

screenshot

Rational numbers are shown as nearest fraction too

rationals

Initial placeholder hint

placeholder

Edited by themadsens
Suggestions from review team
Link to comment
Share on other sites

Because you’re using a script with #!/usr/local/bin/lua as the shebang, it won’t work for people who have installed Lua with Homebrew on Apple Silicon. The correct shebang would be #!/usr/bin/env lua, as itwould then read from the appropriate path.


Lua itself is a dependency, but you haven’t listed it as such. It’s fine in this case, but please be sure to mention dependencies on future submissions.


Finally, the name makes it seem like it interacts with the popular PCalc app, which will be confusing for users searching. Would you consider changing its name?

 

Edited by vitor
Link to comment
Share on other sites

  • themadsens changed the title to basecalc: A programmers calculator for Alfred

Thanks for the feedback and suggestions.

The name is now "basecalc"

 

I was looking for a posting template in order to specify dependencies. I have now added the dependency to the description text

 

The shebang is now 

#!/usr/bin/env lua5.4

this makes  /usr/bin/env the script interpreter which I believe is standard on macOS

 

Note that it is important to explicitly use Lua >= 5.3 for the integer semantics and boolean operators

Link to comment
Share on other sites

  • 2 weeks later...
On 12/19/2022 at 8:39 PM, themadsens said:

The shebang is now

 

That means that if Lua is updated in the future, the user’s install will stop working. It should be #!/usr/bin/env lua as mentioned above.

 

On 12/19/2022 at 8:39 PM, themadsens said:

Note that it is important to explicitly use Lua >= 5.3

 

You can do a check for that inside the workflow itself in a way that won’t have a shebang which will be outdated. Or, more accurately, chances are you can ignore that worry altogether, because the Gallery will mark the workflow as depending on the latest version of lua. Even if someone is on an older version, they’ll be able to upgrade from inside Alfred.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...