themadsens Posted December 18, 2022 Share Posted December 18, 2022 (edited) 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 Rational numbers are shown as nearest fraction too Initial placeholder hint Edited December 19, 2022 by themadsens Suggestions from review team Link to comment Share on other sites More sharing options...
vitor Posted December 19, 2022 Share Posted December 19, 2022 (edited) 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 December 19, 2022 by vitor Link to comment Share on other sites More sharing options...
vitor Posted December 19, 2022 Share Posted December 19, 2022 Updated the above with #!/usr/bin/env lua, which is the better solution. Link to comment Share on other sites More sharing options...
themadsens Posted December 19, 2022 Author Share Posted December 19, 2022 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 More sharing options...
vitor Posted December 29, 2022 Share Posted December 29, 2022 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 More sharing options...
themadsens Posted December 29, 2022 Author Share Posted December 29, 2022 OK, thanks. Done Link to comment Share on other sites More sharing options...
vitor Posted December 29, 2022 Share Posted December 29, 2022 Just sent you a PR but this is pretty ready to go in. Link to comment Share on other sites More sharing options...
themadsens Posted December 29, 2022 Author Share Posted December 29, 2022 Cool. PR merged, and there is a 1.1.3 release vitor 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now