tuxi icon indicating copy to clipboard operation
tuxi copied to clipboard

Added macOS compatibility

Open Zhann opened this issue 3 years ago • 6 comments

Ensures this script works with macOS by leveraging gnu-sed versus freeBSD sed when on macOS.

Also updated README to show macOS specific installation instructions.

Zhann avatar Feb 25 '21 04:02 Zhann

umm I thought someone already did that. Is tuxi is not running on mac?

Bugswriter avatar Feb 25 '21 16:02 Bugswriter

I tested tuxi on macOS and I can confirm that it does not work properly on macOS. sed seems to be throwing errors because it is missing a few features which the GNU version of sed has. This can be seen in the output below:

$ tuxi unix time       
sed: 1: ":a;N;$!ba;s/\n/ /g": unused label 'a;N;$!ba;s/\n/ /g'
sed: 1: ":a;N;$!ba;s/\n/ /g;s/nu ...": unused label 'a;N;$!ba;s/\n/ /g;s/null/\n/g'
usage: paste [-s] [-d delimiters] file ...
---
Unix time is a system for describing a point in
time. It is the number of seconds that have elapsed
since the Unix epoch, minus leap seconds; the Unix epoch
is 00:00:00 UTC on 1 January 1970; leap ...
---

Since we added the "Learn to pronounce" scraper in #152, we can see that the paste command throws an error as well. This can easily be fixed by using gpaste if the user is using macOS.

sdushantha avatar Feb 25 '21 17:02 sdushantha

Rebased and did the same for (g)paste:

❯ tuxi unix time
---
Unix time is a system for describing a point in
time. It is the number of seconds that have elapsed
since the Unix epoch, minus leap seconds; the Unix epoch
is 00:00:00 UTC on 1 January 1970; leap ...
---

Zhann avatar Feb 26 '21 13:02 Zhann

@Zhann remove the bashisms

BeyondMagic avatar Feb 28 '21 18:02 BeyondMagic

@Zhann remove the bashisms

What does that mean? You mean the curly braces? :-)

Zhann avatar Feb 28 '21 20:02 Zhann

What does that mean? You mean the curly braces? :-)

Yes, I sent a PR there.

https://mywiki.wooledge.org/Bashism

BeyondMagic avatar Feb 28 '21 21:02 BeyondMagic