Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/std tui #51

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2202ca9
WIP: std TUI
blaggacao Apr 13, 2022
3ada194
WIP: std TUI
blaggacao Apr 15, 2022
37c9992
WIP: fix filter
blaggacao Apr 15, 2022
644f359
fix linting issues
manveru Apr 15, 2022
1b9e6f2
support j/k for movement
manveru Apr 15, 2022
381cbf8
example of showing help
manveru Apr 15, 2022
ea47b4c
WIP: fix proportions
blaggacao Apr 16, 2022
659ef72
WIP: add markdown help
blaggacao Apr 17, 2022
0e9392c
few renamings
blaggacao Apr 17, 2022
3742e82
readme with tabs
blaggacao Apr 17, 2022
4315e78
add loading spinner & test uninitialized state
blaggacao Apr 18, 2022
98f42c6
prepare for loading the flake metadata
blaggacao Apr 18, 2022
2b8a56b
add left/right for switching focus
blaggacao Apr 18, 2022
306ec0a
organize files
blaggacao Apr 18, 2022
971884d
add nice debugging info when loading of std meta json fails
blaggacao Apr 18, 2022
8432498
add first actual std meta parsing
blaggacao Apr 18, 2022
67cb39a
faint styling when action is missing
blaggacao Apr 18, 2022
9ba15e0
parse first actions
blaggacao Apr 18, 2022
5557949
WIP
blaggacao Apr 19, 2022
eef0f5b
add some clade actions
blaggacao Apr 19, 2022
abec29d
add proper error message display & example data
blaggacao Apr 19, 2022
659eb8b
make the data clade shine
blaggacao Apr 19, 2022
216f8c3
add action inspection
blaggacao Apr 19, 2022
84310bd
WIP
blaggacao Apr 19, 2022
9502139
bump bubbletea (with tea.Cmd)
blaggacao Apr 20, 2022
6bdd96a
use derivation to slightly speed up (and prep for nix-eval-cache)
blaggacao Apr 20, 2022
bc2458f
avoid necessity to declare dependencies
blaggacao Apr 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions cells/std/Readme.md
@@ -0,0 +1 @@
# `std` Cell
30 changes: 30 additions & 0 deletions cells/std/cli.nix
@@ -0,0 +1,30 @@
# SPDX-FileCopyrightText: 2022 The Standard Authors
# SPDX-FileCopyrightText: 2022 Kevin Amado <kamadorueda@gmail.com>
{
inputs,
cell,
}: let
nixpkgs = inputs.nixpkgs;
in {
default = let
commit = inputs.self.shortRev or "dirty";
date = inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101";
version = "0.1.0+${builtins.substring 0 8 date}.${commit}";
in
nixpkgs.buildGoModule rec {
inherit version;
pname = "std";
meta.description = "A tui for projects that conform to Standard";

src = ./cli;

vendorSha256 = null;

ldflags = [
"-s"
"-w"
"-X main.buildVersion=${version}"
"-X main.buildCommit=${commit}"
];
};
}
1 change: 1 addition & 0 deletions cells/std/cli/.gitignore
@@ -0,0 +1 @@
vendor
1 change: 1 addition & 0 deletions cells/std/cli/Readme.md
@@ -0,0 +1 @@
# `cli` Readme
47 changes: 47 additions & 0 deletions cells/std/cli/data/data.go
@@ -0,0 +1,47 @@
package data

import (
"fmt"

"github.com/charmbracelet/bubbles/list"
)

const targetTemplate = "//%s/%s:%s"

type Item struct {
StdName string `json:"__std_name"`
StdOrganelle string `json:"__std_organelle"`
StdCell string `json:"__std_cell"`
StdClade string `json:"__std_clade"`
StdDescription string `json:"__std_description"`
StdCellReadme string `json:"__std_cell_readme"`
StdOrganelleReadme string `json:"__std_organelle_readme"`
StdReadme string `json:"__std_readme"`
StdCladeActions []Action `json:"__std_actions"`
}

func (i Item) Title() string {
return fmt.Sprintf(targetTemplate, i.StdCell, i.StdOrganelle, i.StdName)
}
func (i Item) Description() string { return i.StdDescription }
func (i Item) FilterValue() string { return i.Title() }

func (i Item) GetActionItems() []list.Item {
var numItems = len(i.StdCladeActions)
// Make list of actions
items := make([]list.Item, numItems)
for j := 0; j < numItems; j++ {
items[j] = i.StdCladeActions[j]
}
return items
}

type Action struct {
ActionName string `json:"name"`
ActionCommand []string `json:"command"`
ActionDescription string `json:"description"`
}

func (a Action) Title() string { return a.ActionName }
func (a Action) Description() string { return a.ActionDescription }
func (a Action) FilterValue() string { return a.Title() }
1 change: 1 addition & 0 deletions cells/std/cli/default.md
@@ -0,0 +1 @@
# `std` Readme
113 changes: 0 additions & 113 deletions cells/std/cli/default.nix

This file was deleted.