Compare commits
4 commits
dc26d0b352
...
93c30fc438
Author | SHA1 | Date | |
---|---|---|---|
93c30fc438 | |||
26a909d276 | |||
7741112df6 | |||
2177063ca4 |
2 changed files with 90 additions and 8 deletions
|
@ -5,23 +5,74 @@
|
||||||
|
|
||||||
== Overview
|
== Overview
|
||||||
|
|
||||||
Enbas is a https://docs.gotosocial.org/en/latest/[GoToSocial] client for the terminal.
|
Enbas is a https://docs.gotosocial.org/en/latest/[GoToSocial] client for your terminal written
|
||||||
|
in https://go.dev[Go]. The project is currently a work in progress so breaking changes will be
|
||||||
|
made and bugs may appear here and there during its early development.
|
||||||
|
Enbas has limited functionality at the moment and it is **not** recommended for use
|
||||||
|
with your production GoToSocial servers.
|
||||||
|
|
||||||
|
This project is licensed under GPLv3.
|
||||||
|
|
||||||
=== Repository mirrors
|
=== Repository mirrors
|
||||||
|
|
||||||
- **Code Flow:** https://codeflow.dananglin.me.uk/apollo/enbas
|
- **Code Flow:** https://codeflow.dananglin.me.uk/apollo/enbas
|
||||||
- **Codeberg:** https://codeberg.org/dananglin/enbas
|
- **Codeberg:** https://codeberg.org/dananglin/enbas
|
||||||
- **GitHub:** TBC
|
- **GitHub:** https://github.com/dananglin/enbas
|
||||||
|
|
||||||
== Installation
|
== Installation
|
||||||
|
|
||||||
=== Download
|
=== Download
|
||||||
|
|
||||||
|
Pre-built binaries will be available on the release page on both Codeberg and GitHub when the first
|
||||||
|
release is made.
|
||||||
|
|
||||||
=== Build from source
|
=== Build from source
|
||||||
|
|
||||||
==== With mage
|
==== Requirements
|
||||||
|
|
||||||
==== With go build
|
===== Go
|
||||||
|
|
||||||
|
A minimum version of Go 1.22.0 is required for installing spruce.
|
||||||
|
Please go https://go.dev/dl/[here] to download the latest version.
|
||||||
|
|
||||||
|
===== Mage (Optional)
|
||||||
|
|
||||||
|
The project includes mage targets for building and installing the binary.
|
||||||
|
The main advantage of using mage is that the binary's build information is baked into the binary
|
||||||
|
during compilation. You can visit the https://magefile.org/[Mage website] for instructions on how to install Mage.
|
||||||
|
|
||||||
|
==== Install with mage
|
||||||
|
|
||||||
|
You can install Enbas with Mage using the following commands:
|
||||||
|
[source,console]
|
||||||
|
----
|
||||||
|
git clone https://github.com/dananglin/enbas.git
|
||||||
|
cd enbas/internal/build/
|
||||||
|
mage install
|
||||||
|
----
|
||||||
|
|
||||||
|
By default Mage will attempt to install Enbas to `/usr/local/bin/enbas` which will most likely fail as you won't
|
||||||
|
the permission to write to `/usr/local/bin/`. You will need to either run `sudo mage install`, or you can
|
||||||
|
(preferably) change the install prefix to a directory that you have permission to write to using
|
||||||
|
the `ENBAS_INSTALL_PREFIX` environment variable. For example:
|
||||||
|
|
||||||
|
[source,console]
|
||||||
|
----
|
||||||
|
ENBAS_INSTALL_PREFIX=${HOME}/.local mage install
|
||||||
|
----
|
||||||
|
|
||||||
|
This will install Enbas to `~/.local/bin/enbas`.
|
||||||
|
|
||||||
|
==== Install with go
|
||||||
|
|
||||||
|
If your `GOBIN` directory is included in your `PATH` then you can install Enbas with Go.
|
||||||
|
|
||||||
|
[source,console]
|
||||||
|
----
|
||||||
|
git clone https://github.com/dananglin/enbas.git
|
||||||
|
cd enbas
|
||||||
|
go install ./cmd/enbas
|
||||||
|
----
|
||||||
|
|
||||||
== Configuration
|
== Configuration
|
||||||
|
|
||||||
|
@ -29,6 +80,8 @@ Enbas is a https://docs.gotosocial.org/en/latest/[GoToSocial] client for the ter
|
||||||
|
|
||||||
== Inspirations
|
== Inspirations
|
||||||
|
|
||||||
|
This project was inspired from the following projects:
|
||||||
|
|
||||||
- **madonctl:** https://github.com/McKael/madonctl[A Mastodon CLI client written in Go.]
|
- **madonctl:** https://github.com/McKael/madonctl[A Mastodon CLI client written in Go.]
|
||||||
- **toot:** https://pypi.org/project/toot/[A Mastodon CLI and TUI written in Python.]
|
- **toot:** https://pypi.org/project/toot/[A Mastodon CLI and TUI written in Python.]
|
||||||
- **tut:** https://github.com/RasmusLindroth/tut[A Mastodon TUI written in Go.]
|
- **tut:** https://github.com/RasmusLindroth/tut[A Mastodon TUI written in Go.]
|
||||||
|
|
|
@ -5,15 +5,23 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/magefile/mage/mg"
|
||||||
"github.com/magefile/mage/sh"
|
"github.com/magefile/mage/sh"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Default = Build
|
const (
|
||||||
|
binary = "enbas"
|
||||||
|
defaultInstallPrefix = "/usr/local"
|
||||||
|
envInstallPrefix = "ENBAS_INSTALL_PREFIX"
|
||||||
|
envTestVerbose = "ENBAS_TEST_VERBOSE"
|
||||||
|
envTestCover = "ENBAS_TEST_COVER"
|
||||||
|
)
|
||||||
|
|
||||||
var binary = "enbas"
|
var Default = Build
|
||||||
|
|
||||||
// Test run the go tests.
|
// Test run the go tests.
|
||||||
// To enable verbose mode set ENBAS_TEST_VERBOSE=1.
|
// To enable verbose mode set ENBAS_TEST_VERBOSE=1.
|
||||||
|
@ -27,11 +35,11 @@ func Test() error {
|
||||||
|
|
||||||
args := []string{"./..."}
|
args := []string{"./..."}
|
||||||
|
|
||||||
if os.Getenv("ENBAS_TEST_VERBOSE") == "1" {
|
if os.Getenv(envTestVerbose) == "1" {
|
||||||
args = append(args, "-v")
|
args = append(args, "-v")
|
||||||
}
|
}
|
||||||
|
|
||||||
if os.Getenv("ENBAS_TEST_COVER") == "1" {
|
if os.Getenv(envTestCover) == "1" {
|
||||||
args = append(args, "-cover")
|
args = append(args, "-cover")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +65,27 @@ func Build() error {
|
||||||
return sh.Run("go", "build", "-ldflags="+flags, "-a", "-o", binary, "./cmd/enbas")
|
return sh.Run("go", "build", "-ldflags="+flags, "-a", "-o", binary, "./cmd/enbas")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Install install the executable.
|
||||||
|
func Install() error {
|
||||||
|
mg.Deps(Build)
|
||||||
|
|
||||||
|
installPrefix := os.Getenv(envInstallPrefix)
|
||||||
|
|
||||||
|
if installPrefix == "" {
|
||||||
|
installPrefix = defaultInstallPrefix
|
||||||
|
}
|
||||||
|
|
||||||
|
dest := filepath.Join(installPrefix, "bin", binary)
|
||||||
|
|
||||||
|
if err := sh.Copy(dest, binary); err != nil {
|
||||||
|
return fmt.Errorf("unable to install %s; %w", dest, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("%s successfully installed to %s\n", binary, dest)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Clean clean the workspace.
|
// Clean clean the workspace.
|
||||||
func Clean() error {
|
func Clean() error {
|
||||||
if err := changeToProjectRoot(); err != nil {
|
if err := changeToProjectRoot(); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue