vitor Posted December 16, 2020 Share Posted December 16, 2020 Steps to reproduce:Make a Terminal Command Action.Type a command, but intend the first line one or more spaces.Save.Open the Terminal Command Action.Note the indent on the first line is gone.If multiple empty lines were added at the top, those too will have been stripped. This looks to be on purpose, but I’d argue it’s unexpected behaviour. Having leading spaces isn’t an issue to run a command, but not having them might be inconvenient. Use case: prefixing a command with spaces is a common shell function to say “ignore this from history”. I have a few Terminal Command Actions which include functions and call them after, but I don’t want the functions to keep getting bumped in my history, so I prefix them with spaces. With the current behaviour, that doesn’t work. Alfred 4.3 [1205] macOS 10.14.6 (18G6042) Link to comment Share on other sites More sharing options...
deanishe Posted December 16, 2020 Share Posted December 16, 2020 3 hours ago, vitor said: prefixing a command with spaces is a common shell function to say “ignore this from history”. Did not know that. Thanks. Generally agree that Alfred shouldn't strip leading/trailing whitespace. If it also strips BOMs, it should keep doing that, though. Link to comment Share on other sites More sharing options...
Andrew Posted December 16, 2020 Share Posted December 16, 2020 I am happy to change the Terminal Action to not trim. 4 hours ago, deanishe said: If it also strips BOMs, it should keep doing that, though. uhhh what is BOMs? *google search* Quote BOM - Bill of Materials: A list of the parts that are required to make up a final manufactured item. Generally generated as part of a MRP or similar system. Ah yeah cool, I'll keep trimming these... Vero, deanishe and Mr Pennyworth 3 Link to comment Share on other sites More sharing options...
Tsunami Posted December 16, 2020 Share Posted December 16, 2020 https://en.wikipedia.org/wiki/Byte_order_mark 😉 Link to comment Share on other sites More sharing options...
deanishe Posted December 16, 2020 Share Posted December 16, 2020 5 hours ago, Andrew said: uhhh what is BOMs? *google search* Byte-order marks for UTF-16 and UTF-32 files. For some reason, people keep managing to insert them into Alfred scripts, then bash says "command not found: <BOM>/usr/bin/python" except the BOM is invisible, so it looks like "command not found: /usr/bin/python", which is terribly confusing. Link to comment Share on other sites More sharing options...
Andrew Posted December 16, 2020 Share Posted December 16, 2020 For this field, Alfred was trimming NSCharacterSet.whitespaceAndNewlineCharacterSet: https://developer.apple.com/documentation/foundation/nscharacterset/1413732-whitespaceandnewlinecharacterset?language=objc As far as I can tell, this doesn't include BOM. @deanishe this is interesting, is this quite widespread? Do you think it would be worth warning in Alfred's Run Script / Script Filter objects if there is prefixed BOM? Link to comment Share on other sites More sharing options...
deanishe Posted December 16, 2020 Share Posted December 16, 2020 3 hours ago, Andrew said: is this quite widespread? No. I've only seen it a few times. It's just a real headscratcher when some invisible character is breaking a script. I don't think it's necessary for Alfred to worry about. Andrew 1 Link to comment Share on other sites More sharing options...
Andrew Posted January 22, 2021 Share Posted January 22, 2021 This is now in 4.3.1 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