Bugswriter / tuxi

Tuxi is a cli assistant. Get answers of your questions instantly.
GNU General Public License v3.0
1.33k stars 73 forks source link

Added macOS compatibility #149

Open Zhann opened 3 years ago

Zhann commented 3 years ago

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.

Bugswriter commented 3 years ago

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

sdushantha commented 3 years ago

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.

Zhann commented 3 years ago

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 ...
---
BeyondMagic commented 3 years ago

@Zhann remove the bashisms

Zhann commented 3 years ago

@Zhann remove the bashisms

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

BeyondMagic commented 3 years ago

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

Yes, I sent a PR there.

https://mywiki.wooledge.org/Bashism