hutui

package module
v0.0.0-...-9dc72d6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

README

hutui

A tui for sourcehut. Heavily under development

Configuration

Configuration is looked for at $XDG_HOME_CONFIG/hutui/config.scfg. Like hut, hutui uses the scfg config format. The instance configuration is identical to hut, thought hutui has not yet implemented access-token-cmd.

instance "sr.ht" {
        access-token "<token>"
        meta {
            origin "https://meta.sr.ht"
        }
    }

chat-cmd "senpai"

Installation

Installation requires a go toolchain.

make
sudo make install

Usage

In general there isn't much functionality yet. Don't expect too much.

General
  • <Tab>/<S-Tab> to switch tabs
  • j/k to go up and down lists
  • <Enter> to select something
  • <C-b> to toggle key bypass (useful in a terminal)
  • : to enter command mode
  • :git ~rockorager to see ~rockoragers' git repos
  • :todo ~rockorager to see ~rockoragers' trackers
  • :lists ~rockorager to see ~rockoragers' mailing lists
git

The git tab displays repositories for a user. Navigate to a new users' list by typing :git <username>. Username should include the prefix '~'. Pressing <Enter> on a repository does a shallow clone to $XDG_CACHE_HOME/hutui directory and opens an embedded terminal. The terminal will open to a README, if one is found (using the same rules sourcehut uses to find a README). Otherwise, it will open a blank $EDITOR with the repository as the working directory.

If you open a repo that already exists in your cache, a git pull will be performed instead of a fresh shallow-clone.

When an embedded terminal opens from this view, keys are bypassed. Press <C-b> to toggle the bypass mode.

todo

There isn't much "todo" here. Just a listing so far. See another users' list with :todo <username>, including the prefix

lists

Lists will display a list of your (or another users') mailing lists. Pressing <Enter> will display a list of patches from this mailing list. You can change the status of a patchset (assuming you have write access) with the following commands:

:applied
:approve
:reject
:superseded
:needs-revision
:proposed

When you are viewing a patchlist, you can press 'h' to return back to the user patch list view.

chat

Chat is just an embedded terminal running your chat-cmd. By default, keys are not bypassed when entering this tab. Press <C-b> to enable bypass of all keys (except for <C-b>)

Motivation

Sourcehut is awesome. Terminals are awesome. Why leave the terminal to manage sourcehut stuff? hut is good, but sometimes I like a TUI. So ...TUI.

Also, out of frustration with some other TUI frameworks (looking at you, tview and bubbletea) I wanted to see what it would be like to combine the best of these, rtk is that result, and hutui has been my playground to flesh out the design, and will continue to be - expect breakages.

As such, even though hutui has very limited functionality, it has an entire suite of theming. rtk has built-in support for base16 themes. Some possibilities:

hutui --list-themes | less # See the full list of themes
hutui --theme=onedark # Specify a theme
hutui --theme=random # Be brave

Contributing

Patches and/or questions can be sent to ~rockorager/hutui@lists.sr.ht.

Contact me on IRC: libera.chat=rockorager

Tickets can be submitted at https://todo.sr.ht/~rockorager/hutui

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandMode = &Mode{
	Name:  "COMMAND",
	Color: theme.Base04,
}
View Source
var ErrorMode = &Mode{
	Name:  "ERROR",
	Color: theme.Base08,
}
View Source
var NormalMode = &Mode{
	Name:  "NORMAL",
	Color: theme.Base0B,
}
View Source
var TerminalMode = &Mode{
	Name:  "TERMINAL",
	Color: theme.Base0C,
}

Functions

This section is empty.

Types

type BypassKeys

type BypassKeys bool

type FetchMailingLists

type FetchMailingLists struct {
	Context context.Context
}

type FetchMyRepoList

type FetchMyRepoList struct {
	Context context.Context
}

type FetchPatches

type FetchPatches struct {
	Context context.Context
	// Prefix removed, please
	Owner string
	// list name
	MailingList string
	// Patches cursor
	Cursor *lists.Cursor
}

type FetchTrackerList

type FetchTrackerList struct {
	Context context.Context
}

Fetches authenticated users' trackers, plus any subscriptions

type FetchUserMailingLists

type FetchUserMailingLists struct {
	Context  context.Context
	Username string
}

type FetchUserRepoList

type FetchUserRepoList struct {
	Context  context.Context
	Username string
}

type FetchUserTrackerList

type FetchUserTrackerList struct {
	Context  context.Context
	Username string
}

type GitRepoClosed

type GitRepoClosed struct{}

GitRepoClosed is sent by any repo open in a terminal in the git tab

type Mode

type Mode struct {
	Name  string
	Color func() tcell.Color
}

type ModeMsg

type ModeMsg *Mode

type OpenRepo

type OpenRepo struct {
	Context context.Context
	// Name is in the form "~username/repo-name"
	Name string
}

type PatchsetUpdated

type PatchsetUpdated struct {
	ID     int32
	Status string
}

type Repository

type Repository struct {
	// "~rockorager/hutui"
	Name string
	// The root directory of the repo
	Root string
	// The readme path. If there is none, this will be the same as root
	Readme string
}

type Status

type Status string

type UpdatePatchset

type UpdatePatchset struct {
	Context context.Context
	ID      int32
	Status  string
}

Directories

Path Synopsis
cmd
This file is largely copied from git.sr.ht/~emersion/hut Licensed under GPLv3
This file is largely copied from git.sr.ht/~emersion/hut Licensed under GPLv3
Package log is a zero-dependency colorful, levelled logger.
Package log is a zero-dependency colorful, levelled logger.
widgets

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL