rank

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

README ¶

🌳 Rank

This is a small cli tool that uses a binary selection algorithm to help the user rank items in a list. I have put into a command branch for inclusion into my c Bonzai stateful command tree.

If you just want to try it out, grab the release binary with curl and put into your PATH:

curl -L https://github.com/tr00datp00nar/rank/releases/latest/download/rank-linux-amd64 -o ~/.local/bin/rank
curl -L https://github.com/tr00datp00nar/rank/releases/latest/download/rank-darwin-amd64 -o ~/.local/bin/rank
curl -L https://github.com/tr00datp00nar/rank/releases/latest/download/rank-darwin-arm64 -o ~/.local/bin/rank
curl -L https://github.com/tr00datp00nar/rank/releases/latest/download/rank-windows-amd64 -o ~/.local/bin/rank

Based on the work at https://github.com/carlmjohnson/rank-em

To learn more about Bonzai stateful command trees: https://github.com/rwxrob/bonzai

To see the original Bonzai stateful command tree z: https://github.com/rwxrob/z

Documentation ¶

Index ¶

Constants ¶

This section is empty.

Variables ¶

View Source
var Cmd = &Z.Cmd{
	Name:        `rank`,
	Aliases:     []string{``},
	Usage:       `[help]`,
	Version:     `v0.0.1`,
	Copyright:   `Copyright Micah Nadler 2023`,
	License:     `Apache-2.0`,
	Summary:     help.S(_rank),
	Description: help.D(_rank),

	Commands: []*Z.Cmd{help.Cmd},

	Call: func(x *Z.Cmd, args ...string) error {
		fmt.Print("Items to rank:\n\n")

		r := []string{}
		for {
			item := readline()
			if item == "" {
				break
			}
			r = append(r, item)
		}
		check(scanner.Err())
		BinaryInsertionSort(r, LessPrompt)
		for i, s := range r {
			fmt.Printf("%d. %s\n", i+1, s)
		}
		return nil
	},
}

Functions ¶

func BinaryInsertionSort ¶

func BinaryInsertionSort(a []string, less func(a, b string) bool)

func LessPrompt ¶

func LessPrompt(a, b string) bool

Types ¶

This section is empty.

Directories ¶

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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