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

✨ update doc and help #41

Merged
merged 1 commit into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ default:
.PHONY: preview
preview: doc/preview.gif

doc/preview.gif: doc/preview.tape doc/docker-compose.yaml target/release/doggy
docker compose -f doc/docker-compose.yaml run vhs ./doc/preview.tape
doc/preview.gif: doc/preview.tape doc/docker-compose.yaml target/x86_64-unknown-linux-gnu/release/doggy
docker compose -f doc/docker-compose.yaml run --build vhs ./doc/preview.tape

target/x86_64-unknown-linux-gnu/release/doggy: src/*.rs src/components/*.rs
RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target x86_64-unknown-linux-gnu

.PHONY: tracing
tracing:
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ You can download one of the binary from the release page

## Usage

- Display help screen: `?`
- Change view: `:` and resource name (`containers`, `images`, `networks`, `volumes`)
- Show/hide stopped containers: `a`
- Launch `/bin/bash` in the container: `s`
- Launch a custom command in the container: `S`
- Container view:
- Show/hide stopped containers: `a`
- Launch `/bin/bash` in the container: `s`
- Launch a custom command in the container: `S`
- Show container logs: `l`
- Sort by columns: `F[1234]`
- Inspect resource: `i`
- Delete a resource: `Ctrl+d`
- Browse lists:
Expand All @@ -42,6 +46,7 @@ You can download one of the binary from the release page
- [x] Display the stopped containers
- [ ] Filter the container list
- [x] Inspect containers
- [x] View container logs
- [x] Exec `/bin/bash` in a container
- [x] Delete containers (running or stopped)
- [x] List images
Expand Down
62 changes: 62 additions & 0 deletions doc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
FROM tsl0922/ttyd:alpine as ttyd
FROM alpine:latest as fontcollector

# Install Fonts
RUN apk add --no-cache \
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/main \
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \
font-adobe-source-code-pro font-source-code-pro-nerd \
font-dejavu font-dejavu-sans-mono-nerd \
font-fira-code font-fira-code-nerd \
font-hack font-hack-nerd \
font-ibm-plex-mono-nerd \
font-inconsolata font-inconsolata-nerd \
font-jetbrains-mono font-jetbrains-mono-nerd \
font-liberation font-liberation-mono-nerd \
font-noto \
font-roboto-mono \
font-ubuntu font-ubuntu-mono-nerd \
font-noto-emoji

FROM debian:unstable-slim

RUN apt-get update

# Add fonts
COPY --from=fontcollector /usr/share/fonts/ /usr/share/fonts

# Install latest ttyd
COPY --from=ttyd /usr/bin/ttyd /usr/bin/ttyd

# Expose port
EXPOSE 1976

# Create volume
VOLUME /vhs
WORKDIR /vhs

# Install Dependencies
RUN apt-get -y install ffmpeg chromium bash
RUN apt-get -y install curl

# Create user
RUN useradd -u 1976 -U -s /bin/false vhs
# Mimic alpine default color option
RUN echo 'alias ls="ls --color"' >> ~/.bashrc
# Install
RUN curl -L https://github.com/charmbracelet/vhs/releases/download/v0.7.1/vhs_0.7.1_amd64.deb -o /tmp/vhs_0.7.1_amd64.deb
RUN dpkg -i /tmp/vhs_0.7.1_amd64.deb
RUN rm /tmp/vhs_0.7.1_amd64.deb
#COPY vhs /usr/bin/

ENV VHS_PORT "1976"
ENV VHS_HOST "0.0.0.0"
ENV VHS_GID "1976"
ENV VHS_UID "1976"
ENV VHS_KEY_PATH "/vhs/vhs"
ENV VHS_AUTHORIZED_KEYS_PATH ""
ENV VHS_NO_SANDBOX "true"

ENTRYPOINT ["/usr/bin/vhs"]

1 change: 1 addition & 0 deletions doc/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: "3.8"
services:
vhs:
image: ghcr.io/charmbracelet/vhs
build: .
working_dir: /vhs
volumes:
- ../:/vhs
Expand Down
9 changes: 5 additions & 4 deletions doc/preview.tape
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Set TypingSpeed 100ms

# Type a command in the terminal.
Type "./target/release/doggy"
# Type "./target/x86_64-unknown-linux-gnu/release/doggy"

Enter

Expand Down Expand Up @@ -49,10 +50,10 @@ Type "j"
Sleep 200ms
Type "j"
Sleep 200ms
Ctrl+d
Sleep 1s
Enter
Sleep 2s
#Ctrl+d
#Sleep 1s
#Enter
#Sleep 2s
Type "i"
Sleep 1s
PageDown
Expand Down
4 changes: 4 additions & 0 deletions src/components/containers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@ impl Component for Containers {
("l", "Logs"),
("s", "Execute '/bin/bash' in container"),
("S", "Execute custom command"),
("F1", "Sort by container id"),
("F2", "Sort by container name"),
("F3", "Sort by image name"),
("F4", "Sort by status"),
])
}

Expand Down
11 changes: 9 additions & 2 deletions src/components/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use tokio::sync::mpsc::UnboundedSender;
use crate::action::Action;
use crate::components::Component;
use crate::runtime::{delete_image, get_image, list_images};
use crate::utils::{centered_rect, table, COMMON_LIST_BINDINGS};
use crate::utils::{centered_rect, table};

const IMAGE_CONSTRAINTS: [Constraint; 4] = [
Constraint::Max(15),
Expand Down Expand Up @@ -238,6 +238,13 @@ impl Component for Images {
}

fn get_bindings(&self) -> Option<&[(&str, &str)]> {
Some(&COMMON_LIST_BINDINGS)
Some(&[
("ctrl+d", "Delete"),
("i", "Inspect/View details"),
("F1", "Sort by image id"),
("F2", "Sort by image name"),
("F3", "Sort by image size"),
("F4", "Sort by image age"),
])
}
}
11 changes: 9 additions & 2 deletions src/components/networks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use tokio::sync::mpsc::UnboundedSender;
use crate::action::Action;
use crate::components::Component;
use crate::runtime::{delete_network, get_network, list_networks};
use crate::utils::{centered_rect, table, COMMON_LIST_BINDINGS};
use crate::utils::{centered_rect, table};

const NETWORK_CONSTRAINTS: [Constraint; 4] = [
Constraint::Max(15),
Expand Down Expand Up @@ -243,6 +243,13 @@ impl Component for Networks {
}

fn get_bindings(&self) -> Option<&[(&str, &str)]> {
Some(&COMMON_LIST_BINDINGS)
Some(&[
("ctrl+d", "Delete"),
("i", "Inspect/View details"),
("F1", "Sort by network id"),
("F2", "Sort by network name"),
("F3", "Sort by network driver"),
("F4", "Sort by image age"),
])
}
}
11 changes: 9 additions & 2 deletions src/components/volumes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use tokio::sync::mpsc::UnboundedSender;
use crate::action::Action;
use crate::components::Component;
use crate::runtime::{delete_volume, get_volume, list_volumes};
use crate::utils::{centered_rect, table, COMMON_LIST_BINDINGS};
use crate::utils::{centered_rect, table};

const VOLUME_CONSTRAINTS: [Constraint; 4] = [
Constraint::Max(15),
Expand Down Expand Up @@ -237,6 +237,13 @@ impl Component for Volumes {
}

fn get_bindings(&self) -> Option<&[(&str, &str)]> {
Some(&COMMON_LIST_BINDINGS)
Some(&[
("ctrl+d", "Delete"),
("i", "Inspect/View details"),
("F1", "Sort by volume id"),
("F2", "Sort by volume driver"),
("F3", "Sort by volume size"),
("F4", "Sort by volume age"),
])
}
}
3 changes: 0 additions & 3 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ const NAVIGATION_BINDINGS: [(&str, &str); 4] = [
("PageDown", "Page down"),
];

pub(crate) const COMMON_LIST_BINDINGS: [(&str, &str); 2] =
[("ctrl+d", "Delete"), ("i", "Inspect/View details")];

fn project_directory() -> Option<ProjectDirs> {
ProjectDirs::from("org", "pyaillet", env!("CARGO_PKG_NAME"))
}
Expand Down