Go rewrite of moreutils.
GPL-3.0 License
A Go rewrite of moreutils: A collection of the Unix tools that nobody thought to write long ago when Unix was young.
Some of the original moreutils commands require Perl, so I decided to rewrite them in a language which can compile into a single binary with no dependencies.
If you don't have it already, install the ca-certificates
package
sudo apt install ca-certificates
Add gabe565 apt repository
echo 'deb [trusted=yes] https://apt.gabe565.com /' | sudo tee /etc/apt/sources.list.d/gabe565.list
Update apt repositories
sudo apt update
Install moreutils-go
sudo apt install moreutils-go
If you don't have it already, install the ca-certificates
package
sudo dnf install ca-certificates
Add gabe565 rpm repository to /etc/yum.repos.d/gabe565.repo
[gabe565]
name=gabe565
baseurl=https://rpm.gabe565.com
enabled=1
gpgcheck=0
Install moreutils-go
sudo dnf install moreutils-go
Install moreutils-go-bin with your AUR helper of choice.
Install moreutils-go from gabe565/homebrew-tap:
brew install gabe565/tap/moreutils-go
This repository can be added to a GitHub Actions workflow to install the applets.
name: Example
on: push
jobs:
example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gabe565/moreutils-go@v0
- run: echo hello world | ts
A Docker image is available at ghcr.io/gabe565/moreutils
In this container, all applets are in the root directory.
Some commands can be run directly from a terminal:
echo hello world | docker run --rm -i ghcr.io/gabe565/moreutils ts
If you are building a container and need one of the applets, you can copy them directly to your container during build:
FROM alpine
COPY --from=ghcr.io/gabe565/moreutils:0 /usr/bin/ts /usr/bin
CMD echo hello world | ts
moreutils install -sr DIRECTORY
to generate symlinks for each command.My goal is 100% compatability, but there are currently some differences compared to moreutils:
Applet | Differences |
---|---|
errno | The original implementation prints some errors which are not used by the current OS. For example, code 35 could match EAGAIN and EWOULDBLOCK . Most operating systems only use one or the other, so this implementation does not print duplicates. |
ifdata | The rewrite supports the -ph and -pf flags on all operating systems, and all statistics flags on Linux and Darwin. |
isutf8 | Unlike moreutils, which prints the expected value range for non-UTF-8 files, the rewrite only logs the offending line, byte, and char. |
lckdo | Deprecated in moreutils and intentionally not implemented here. It is recommended to use flock as a replacement. |
parallel | Parallel is not symlinked by default since GNU Parallel is typically preferred. |
ts | The -m flag does not affect functionality since Go always uses the system's monotonic clock. |