47 Commits

Author SHA1 Message Date
2273c0156e Clean up CI. 2026-02-21 18:30:26 -05:00
417f01b527 remove [env] 2026-02-21 18:24:18 -05:00
d776602fe8 Remove debug. 2026-02-21 18:20:51 -05:00
e2ddadd952 Don't force in cargo.toml 2026-02-21 18:20:29 -05:00
61c7f59237 debug 2026-02-21 18:16:56 -05:00
1e63eabd46 Set qmake? 2026-02-21 18:12:45 -05:00
ac83b3e30f Don't set QMAKE. 2026-02-21 18:04:53 -05:00
a42ad73a57 Add setup action. 2026-02-21 18:01:51 -05:00
1ec13aa43a Move env. 2026-02-21 17:52:38 -05:00
0a3f095080 Install qt using action. 2026-02-21 17:51:09 -05:00
6474c5b6bd Reuse steps. 2026-02-21 17:49:42 -05:00
717ea70895 Fix qmake. 2026-02-21 17:37:46 -05:00
8eada4bbee Update push. 2026-02-21 17:35:04 -05:00
0ebd45ae15 Move CI to github.
Some checks failed
Build / Build (pull_request) Failing after 9s
Why not, it's free.
2026-02-21 17:32:44 -05:00
14e7514cc1 Merge jobs.
Some checks failed
Build / Build (pull_request) Failing after 31m19s
2026-02-21 17:25:58 -05:00
b3bb13fa33 22.04
Some checks failed
Build / Build (pull_request) Failing after 10s
Build / Test (pull_request) Failing after 4s
2026-02-21 17:24:36 -05:00
ad95056376 fix path.
Some checks failed
Build / Build (pull_request) Failing after 4s
Build / Test (pull_request) Failing after 4s
2026-02-21 17:23:22 -05:00
384fa51b6e Test with ubuntu:latest.
Some checks failed
Build / Build (pull_request) Failing after 6s
Build / Test (pull_request) Failing after 3s
ubuntu:24.04 was not defined in the runner's docker-compose.yaml server side.
2026-02-21 17:21:40 -05:00
fc2a44740f Use ubuntu-latest.
Some checks failed
Build / Build (pull_request) Failing after 4m36s
Build / Test (pull_request) Failing after 3s
2026-02-21 17:17:52 -05:00
f609aa02db Update env.
Some checks failed
Build / Build (pull_request) Failing after 5s
Build / Test (pull_request) Failing after 5s
2026-02-21 17:12:07 -05:00
fdb4f0db0b Test named volume.
Some checks failed
Build / Build (pull_request) Failing after 10s
Build / Test (pull_request) Failing after 4s
2026-02-21 16:53:03 -05:00
2d5e721a79 Update environment.
Some checks failed
Build / Build (pull_request) Failing after 7s
2026-02-21 16:52:42 -05:00
2e55ba1a4b Source rust things.
Some checks failed
Build / Build (pull_request) Failing after 19m32s
2026-02-21 16:40:34 -05:00
6b9e3b1b40 Update name. 2026-02-21 16:26:18 -05:00
bdb126cab5 Fix apt install.
Some checks failed
Build / Build (pull_request) Failing after 17m52s
2026-02-21 16:22:10 -05:00
a4f6f199ec Test.
Some checks failed
Build / Build (pull_request) Failing after 50s
2026-02-21 16:16:19 -05:00
911a29937e Install libgl. 2026-02-21 16:16:06 -05:00
579826d398 Add badge for build CI. 2026-02-21 16:00:59 -05:00
3b1f33f055 Fix qt version.
Some checks failed
Build / Build (pull_request) Failing after 17m17s
2026-02-21 15:54:40 -05:00
607dae32fe Checkout.
Some checks failed
Build / Build (pull_request) Failing after 3m56s
2026-02-21 15:49:16 -05:00
bb032e9daf Source rust.
Some checks failed
Build / Build (pull_request) Failing after 2m0s
2026-02-21 15:45:43 -05:00
886a32a9e2 Set QMAKE.
Some checks failed
Build / Build (pull_request) Failing after 1m55s
2026-02-21 15:42:55 -05:00
0c58b6c436 Update arch.
Some checks failed
Build / Build (pull_request) Failing after 1m59s
2026-02-21 15:38:05 -05:00
df3547267b update
Some checks failed
Build / Build (pull_request) Failing after 1m31s
2026-02-21 15:34:30 -05:00
a605c4929e Use aqtinstall directly.
Some checks failed
Build / Build (pull_request) Failing after 40s
2026-02-21 15:33:11 -05:00
a40125416d Python
Some checks failed
Build / Build (pull_request) Failing after 57s
2026-02-21 15:28:00 -05:00
6777a44b3b Remove sudo
Some checks failed
Build / Build (pull_request) Failing after 1m9s
2026-02-21 15:25:01 -05:00
288298ac18 Install python.
Some checks failed
Build / Build (pull_request) Failing after 49s
2026-02-21 15:21:53 -05:00
d461a29ff9 Yes.
Some checks failed
Build / Build (push) Failing after 54s
Build / Build (pull_request) Failing after 56s
2026-02-21 15:18:42 -05:00
bc906cd7f3 Install things in CI.
Some checks failed
Build / Build (push) Failing after 1m26s
Build / Build (pull_request) Failing after 16s
2026-02-21 15:15:18 -05:00
8ddff3fe9e Test gitea CI.
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 23s
2026-02-21 15:06:08 -05:00
289f94300c Move EntryMeta to libclide. 2026-02-21 14:59:48 -05:00
d95aa680ff Add missing headers. 2026-02-21 14:56:28 -05:00
1119b3db9b Add libclide. 2026-02-21 14:41:17 -05:00
7ad25af13d Ignore .qmlls.ini. 2026-02-21 14:40:22 -05:00
7d4f23d82a Fix bug showing project name in explorer. 2026-02-21 14:24:44 -05:00
b4e14f7f27 Fix bug preventing TUI editors from opening.
Also fix bugs building file tree for paths including `../`.
2026-02-21 14:21:28 -05:00
16 changed files with 554 additions and 187 deletions

View File

@@ -1,6 +1,2 @@
[build] [build]
rustflags = [ "-C", "link-arg=-fuse-ld=lld", ] rustflags = [ "-C", "link-arg=-fuse-ld=lld", ]
[env]
QMAKE="/opt/Qt/6.7.3/gcc_64/bin/qmake6"
LD_LIBRARY_PATH="/opt/Qt/6.7.3/gcc_64/lib"

20
.github/actions/setup-qt/action.yml vendored Normal file
View File

@@ -0,0 +1,20 @@
name: "Setup Qt"
description: "Install clide dependencies"
inputs:
qt-version:
description: "Qt version to install"
required: true
runs:
using: "composite"
steps:
- name: Install apt packages
run: |
sudo apt update -y
sudo apt install -y build-essential cmake curl libgl1-mesa-dev python3 python3-pip
shell: bash
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: ${{ inputs.qt-version }}

67
.github/workflows/build.yaml vendored Normal file
View File

@@ -0,0 +1,67 @@
name: Build
on:
push:
branches:
- '**'
tags:
- 'v*'
pull_request:
env:
QT_VERSION: 6.7.3
jobs:
Build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Qt
uses: ./.github/actions/setup-qt
with:
qt-version: ${{ env.QT_VERSION }}
- name: Build libclide
run: |
cargo b -p libclide --release
- name: Build clide
run: |
cargo b --release
Test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Qt
uses: ./.github/actions/setup-qt
with:
qt-version: ${{ env.QT_VERSION }}
- name: Test libclide
run: |
cargo test -p libclide
- name: Test clide
run: |
cargo test
Lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Qt
uses: ./.github/actions/setup-qt
with:
qt-version: ${{ env.QT_VERSION }}
- name: Lint libclide
run: |
cargo clippy --manifest-path libclide/Cargo.toml -- -D warnings
- name: Lint clide
run: |
cargo clippy -- -D warnings

3
.gitignore vendored
View File

@@ -1,4 +1,5 @@
**/target/** **/target/**
**/.qtcreator/** **/.qtcreator/**
**/.idea/** **/.idea/**
**/*.autosave/** **/*.autosave/**
**/.qmlls.ini

486
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -17,8 +17,8 @@ tui-tree-widget = "0.24.0"
tui-logger = "0.18.1" tui-logger = "0.18.1"
edtui = "0.11.1" edtui = "0.11.1"
strum = "0.27.2" strum = "0.27.2"
uuid = { version = "1.19.0", features = ["v4"] }
devicons = "0.6.12" devicons = "0.6.12"
libclide = { path = "./libclide" }
[build-dependencies] [build-dependencies]
# The link_qt_object_files feature is required for statically linking Qt 6. # The link_qt_object_files feature is required for statically linking Qt 6.

View File

@@ -1,5 +1,7 @@
# CLIDE # CLIDE
[![Build](https://git.shaunreed.com/shaunrd0/clide/actions/workflows/build.yaml/badge.svg)](https://git.shaunreed.com/shaunrd0/clide/workflows/build.yml)
CLIDE is an extendable command-line driven development environment written in Rust using the Qt UI framework that supports both full and headless Linux environments. CLIDE is an extendable command-line driven development environment written in Rust using the Qt UI framework that supports both full and headless Linux environments.
The GUI is written in QML compiled through Rust using the cxx-qt crate, while the TUI was implemented using the ratatui crate. The GUI is written in QML compiled through Rust using the cxx-qt crate, while the TUI was implemented using the ratatui crate.

16
libclide/Cargo.lock generated Normal file
View File

@@ -0,0 +1,16 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "anyhow"
version = "1.0.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
[[package]]
name = "libclide"
version = "0.1.0"
dependencies = [
"anyhow",
]

7
libclide/Cargo.toml Normal file
View File

@@ -0,0 +1,7 @@
[package]
name = "libclide"
version = "0.1.0"
edition = "2024"
[dependencies]
anyhow = "1.0.102"

5
libclide/src/fs.rs Normal file
View File

@@ -0,0 +1,5 @@
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
//
// SPDX-License-Identifier: GNU General Public License v3.0 or later
pub mod entry_meta;

View File

@@ -0,0 +1,50 @@
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
//
// SPDX-License-Identifier: GNU General Public License v3.0 or later
use std::path::{Path, PathBuf};
use anyhow::{Context, Result};
#[derive(Debug)]
pub struct EntryMeta {
pub abs_path: String,
pub file_name: String,
pub is_dir: bool,
}
impl EntryMeta {
/// Normalizes a path, returning an absolute from the root of the filesystem.
/// Does not resolve symlinks and extracts `./` or `../` segments.
fn normalize<P: AsRef<Path>>(p: P) -> PathBuf {
let path = p.as_ref();
let mut buf = PathBuf::new();
for comp in path.components() {
match comp {
std::path::Component::ParentDir => {
buf.pop();
}
std::path::Component::CurDir => {}
_ => buf.push(comp),
}
}
buf
}
pub fn new<P: AsRef<Path>>(p: P) -> Result<Self> {
let path = p.as_ref();
let is_dir = path.is_dir();
let abs_path = Self::normalize(&path).to_string_lossy().to_string();
let file_name = Path::new(&abs_path)
.file_name()
.context(format!("Failed to get file name for path: {abs_path:?}"))?
.to_string_lossy()
.to_string();
Ok(EntryMeta {
abs_path,
file_name,
is_dir,
})
}
}

5
libclide/src/lib.rs Normal file
View File

@@ -0,0 +1,5 @@
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
//
// SPDX-License-Identifier: GNU General Public License v3.0 or later
pub mod fs;

View File

@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
//
// SPDX-License-Identifier: GNU General Public License v3.0 or later
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15

View File

@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
//
// SPDX-License-Identifier: GNU General Public License v3.0 or later
import QtQuick import QtQuick
import QtQuick.Controls.Basic import QtQuick.Controls.Basic

View File

@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
//
// SPDX-License-Identifier: GNU General Public License v3.0 or later
import QtQuick import QtQuick
import QtQuick.Controls.Basic import QtQuick.Controls.Basic

View File

@@ -4,21 +4,21 @@
use crate::tui::component::{Action, Component, ComponentState, Focus, FocusState}; use crate::tui::component::{Action, Component, ComponentState, Focus, FocusState};
use anyhow::{Context, Result, bail}; use anyhow::{Context, Result, bail};
use log::trace; use log::{trace};
use ratatui::buffer::Buffer; use ratatui::buffer::Buffer;
use ratatui::crossterm::event::{Event, KeyCode, KeyEvent, MouseEvent, MouseEventKind}; use ratatui::crossterm::event::{Event, KeyCode, KeyEvent, MouseEvent, MouseEventKind};
use ratatui::layout::{Alignment, Position, Rect}; use ratatui::layout::{Alignment, Position, Rect};
use ratatui::prelude::Style; use ratatui::prelude::Style;
use ratatui::style::{Color, Modifier}; use ratatui::style::{Color, Modifier};
use ratatui::widgets::{Block, Borders, StatefulWidget, Widget}; use ratatui::widgets::{Block, Borders, StatefulWidget, Widget};
use std::ffi::OsStr;
use std::fs; use std::fs;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use tui_tree_widget::{Tree, TreeItem, TreeState}; use tui_tree_widget::{Tree, TreeItem, TreeState};
use libclide::fs::entry_meta::EntryMeta;
#[derive(Debug)] #[derive(Debug)]
pub struct Explorer<'a> { pub struct Explorer<'a> {
pub(crate) root_path: PathBuf, root_path: EntryMeta,
tree_items: TreeItem<'a, String>, tree_items: TreeItem<'a, String>,
tree_state: TreeState<String>, tree_state: TreeState<String>,
pub(crate) component_state: ComponentState, pub(crate) component_state: ComponentState,
@@ -30,7 +30,7 @@ impl<'a> Explorer<'a> {
pub fn new(path: &PathBuf) -> Result<Self> { pub fn new(path: &PathBuf) -> Result<Self> {
trace!(target:Self::ID, "Building {}", Self::ID); trace!(target:Self::ID, "Building {}", Self::ID);
let explorer = Explorer { let explorer = Explorer {
root_path: path.to_owned(), root_path: EntryMeta::new(&path)?,
tree_items: Self::build_tree_from_path(path.to_owned())?, tree_items: Self::build_tree_from_path(path.to_owned())?,
tree_state: TreeState::default(), tree_state: TreeState::default(),
component_state: ComponentState::default().with_help_text(concat!( component_state: ComponentState::default().with_help_text(concat!(
@@ -41,46 +41,46 @@ impl<'a> Explorer<'a> {
Ok(explorer) Ok(explorer)
} }
fn build_tree_from_path(path: PathBuf) -> Result<TreeItem<'static, String>> { /// Builds the file tree from a path using recursion.
/// The identifiers used for the TreeItems are normalized. Symlinks are not resolved.
/// Resolving symlinks would cause collisions on the TreeItem unique identifiers within the set.
fn build_tree_from_path<P: AsRef<Path>>(p: P) -> Result<TreeItem<'static, String>> {
let path = p.as_ref();
let mut children = vec![]; let mut children = vec![];
let clean_path = fs::canonicalize(path)?; let path_meta = EntryMeta::new(path)?;
if let Ok(entries) = fs::read_dir(&clean_path) { if let Ok(entries) = fs::read_dir(&path_meta.abs_path) {
let mut paths = entries let mut paths = entries
.map(|res| res.map(|e| e.path())) .map(|res| res.map(|e| e.path()))
.collect::<Result<Vec<_>, std::io::Error>>() .collect::<Result<Vec<_>, std::io::Error>>()
.context(format!( .context(format!(
"Failed to build vector of paths under directory: {:?}", "Failed to build vector of paths under directory: {:?}",
clean_path &path_meta.abs_path
))?; ))?;
paths.sort(); paths.sort();
for path in paths { for entry_path in paths {
if path.is_dir() { let entry_meta = EntryMeta::new(&entry_path)?;
children.push(Self::build_tree_from_path(path)?); if entry_meta.is_dir {
children.push(Self::build_tree_from_path(&entry_meta.abs_path)?);
} else { } else {
if let Ok(path) = fs::canonicalize(&path) { children.push(TreeItem::new_leaf(
let path_str = path.to_string_lossy().to_string(); entry_meta.abs_path.clone(),
children.push(TreeItem::new_leaf( entry_meta.file_name.clone(),
path_str + uuid::Uuid::new_v4().to_string().as_str(), ));
path.file_name()
.context("Failed to get file name from path.")?
.to_string_lossy()
.to_string(),
));
}
} }
} }
} }
// Note: The first argument is a unique identifier, where no 2 TreeItems may share the same.
// For a file tree this is fine because we shouldn't list the same object twice.
TreeItem::new( TreeItem::new(
clean_path.to_string_lossy().to_string() + uuid::Uuid::new_v4().to_string().as_str(), path_meta.abs_path.clone(),
clean_path path_meta.file_name.clone(),
.file_name()
.context(format!("Failed to get file name from path: {clean_path:?}"))?
.to_string_lossy()
.to_string(),
children, children,
) )
.context(format!("Failed to build tree from path: {clean_path:?}")) .context(format!(
"Failed to build tree from path: {:?}",
path_meta.abs_path
))
} }
pub fn selected(&self) -> Result<String> { pub fn selected(&self) -> Result<String> {
@@ -97,15 +97,11 @@ impl<'a> Explorer<'a> {
impl<'a> Widget for &mut Explorer<'a> { impl<'a> Widget for &mut Explorer<'a> {
fn render(self, area: Rect, buf: &mut Buffer) { fn render(self, area: Rect, buf: &mut Buffer) {
if let Ok(tree) = Tree::new(&self.tree_items.children()) { if let Ok(tree) = Tree::new(&self.tree_items.children()) {
let file_name = self
.root_path
.file_name()
.unwrap_or_else(|| OsStr::new("Unknown"));
StatefulWidget::render( StatefulWidget::render(
tree.block( tree.block(
Block::default() Block::default()
.borders(Borders::ALL) .borders(Borders::ALL)
.title(file_name.to_string_lossy()) .title(self.root_path.file_name.clone())
.border_style(Style::default().fg(self.component_state.get_active_color())) .border_style(Style::default().fg(self.component_state.get_active_color()))
.title_style(Style::default().fg(Color::Green)) .title_style(Style::default().fg(Color::Green))
.title_alignment(Alignment::Center), .title_alignment(Alignment::Center),