Compare commits
2 Commits
802cf8e9d3
...
ui
| Author | SHA1 | Date | |
|---|---|---|---|
| 9fc7864f31 | |||
| 439d3af7d3 |
65
README.md
65
README.md
@@ -3,8 +3,7 @@
|
||||
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.
|
||||
|
||||
It's up to you to build your own development environment for your tools.
|
||||
To add tools for your purposes, create a plugin that implements the `ClidePlugin` trait. (This is currently under development and not yet available.)
|
||||
It's up to you to build your own development environment for your tools. Plugins are planned to be supported in the future for bringing your own language-specific tools or features.
|
||||
Once you've created your plugin, you can submit a pull request to add a link to the git repository for your plugin to the final section in this README if you'd like to contribute.
|
||||
|
||||
The following packages must be installed before the application will build.
|
||||
@@ -20,6 +19,68 @@ And of course, [Rust](https://www.rust-lang.org/tools/install).
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
To install and run clide
|
||||
|
||||
```bash
|
||||
git clone https://git.shaunreed.com/shaunrd0/clide
|
||||
cd clide
|
||||
cargo install --path .
|
||||
```
|
||||
|
||||
After installation `clide` can be used directly
|
||||
|
||||
```bash
|
||||
clide --help
|
||||
|
||||
Extendable command-line driven development environment written in Rust using the Qt UI framework.
|
||||
If no flags are provided, the GUI editor is launched in a separate process.
|
||||
If no path is provided, the current directory is used.
|
||||
|
||||
Usage: clide [OPTIONS] [PATH]
|
||||
|
||||
Arguments:
|
||||
[PATH] The root directory for the project to open with the clide editor
|
||||
|
||||
Options:
|
||||
-t, --tui Run clide in headless mode
|
||||
-g, --gui Run the clide GUI in the current process, blocking the terminal and showing all output streams
|
||||
-h, --help Print help
|
||||
```
|
||||
|
||||
### TUI
|
||||
|
||||
The TUI is implemented using the ratatui crate and has the typical features you would expect from a text editor.
|
||||
You can browse your project tree, open / close new editor tabs, and save / reload files.
|
||||
Controls for the TUI are listed at the bottom of the window, and update depending on which widget you have focused.
|
||||
For now, there are no language-specific features or plugins available for the TUI – it is only a text editor.
|
||||
|
||||
To run the TUI, pass the `-t` or `--tui` flags.
|
||||
|
||||
```bash
|
||||
# With cargo from the project root
|
||||
cargo run -- -t
|
||||
# Or via clide directly after installation
|
||||
clide -t
|
||||
```
|
||||
|
||||

|
||||
|
||||
### GUI
|
||||
|
||||
The GUI is still in development. It is at this point a text viewer, instead of a text editor.
|
||||
There are many placeholder buttons and features in the GUI that do nothing when used.
|
||||
|
||||
The GUI is run by default when executing the `clide` application.
|
||||
|
||||
```bash
|
||||
# With cargo from the project root
|
||||
cargo run
|
||||
# Or via clide directly after installation
|
||||
clide
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
It's recommended to use RustRover or Qt Creator for development.
|
||||
|
||||
BIN
resources/tui.png
Normal file
BIN
resources/tui.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 533 KiB |
@@ -6,7 +6,7 @@ use std::process::{Command, Stdio};
|
||||
|
||||
pub mod gui;
|
||||
pub mod tui;
|
||||
/// Command line interface IDE with full GUI and headless modes.
|
||||
/// Extendable command-line driven development environment written in Rust using the Qt UI framework.
|
||||
/// If no flags are provided, the GUI editor is launched in a separate process.
|
||||
/// If no path is provided, the current directory is used.
|
||||
#[derive(Parser, Debug)]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use log::trace;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::{Constraint, Direction, Layout, Rect};
|
||||
use ratatui::style::{Modifier, Style};
|
||||
|
||||
@@ -20,9 +20,6 @@ use ratatui::widgets::{Paragraph, Wrap};
|
||||
use std::path::PathBuf;
|
||||
use std::time::Duration;
|
||||
|
||||
// TODO: Need a way to dynamically run Widget::render on all widgets.
|
||||
// TODO: + Need a way to map Rect to Component::id() to position each widget?
|
||||
// TODO: Need a good way to dynamically run Component methods on all widgets.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum AppComponent {
|
||||
AppEditor,
|
||||
@@ -48,7 +45,7 @@ impl<'a> App<'a> {
|
||||
pub fn new(root_path: PathBuf) -> Result<Self> {
|
||||
trace!(target:Self::id(), "Building {}", Self::id());
|
||||
let app = Self {
|
||||
editor_tabs: EditorTab::new(&root_path.join("src/tui/app.rs")),
|
||||
editor_tabs: EditorTab::new(None),
|
||||
explorer: Explorer::new(&root_path)?,
|
||||
logger: Logger::new(),
|
||||
menu_bar: MenuBar::new(),
|
||||
@@ -61,17 +58,6 @@ impl<'a> App<'a> {
|
||||
/// Logic that should be executed once on application startup.
|
||||
pub fn start(&mut self) -> Result<()> {
|
||||
trace!(target:Self::id(), "Starting App");
|
||||
let root_path = self.explorer.root_path.clone();
|
||||
let editor = self
|
||||
.editor_tabs
|
||||
.current_editor_mut()
|
||||
.context("Failed to get current editor in App::start")?;
|
||||
editor
|
||||
.set_contents(&root_path.join("src/tui/app.rs"))
|
||||
.context(format!(
|
||||
"Failed to initialize editor contents to path: {root_path:?}"
|
||||
))?;
|
||||
editor.component_state.set_focus(Focus::Active);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -23,13 +23,25 @@ impl EditorTab {
|
||||
"EditorTab"
|
||||
}
|
||||
|
||||
pub fn new(path: &std::path::PathBuf) -> Self {
|
||||
pub fn new(path: Option<&std::path::PathBuf>) -> Self {
|
||||
trace!(target:Self::id(), "Building EditorTab with path {path:?}");
|
||||
let tab_order = vec![path.to_string_lossy().to_string()];
|
||||
Self {
|
||||
editors: HashMap::from([(tab_order.first().unwrap().to_owned(), Editor::new(path))]),
|
||||
tab_order,
|
||||
current_editor: 0,
|
||||
match path {
|
||||
None => Self {
|
||||
editors: HashMap::new(),
|
||||
tab_order: Vec::new(),
|
||||
current_editor: 0,
|
||||
},
|
||||
Some(path) => {
|
||||
let tab_order = vec![path.to_string_lossy().to_string()];
|
||||
Self {
|
||||
editors: HashMap::from([(
|
||||
tab_order.first().unwrap().to_owned(),
|
||||
Editor::new(path),
|
||||
)]),
|
||||
tab_order,
|
||||
current_editor: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user