Skip to content

Commit

Permalink
Add a license and a README
Browse files Browse the repository at this point in the history
  • Loading branch information
Dlurak committed Aug 22, 2024
1 parent 0e1363d commit 79dae9e
Show file tree
Hide file tree
Showing 8 changed files with 748 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
[package]
name = "muxmate"
name = "moxide"
version = "0.1.0"
edition = "2021"
license = "GPL-3.0-only"
readme = "README.md"
authors = ["Dlurak"]
description = "Moxide is a powerful tmux session manager."
homepage = "https://github.com/Dlurak/moxide"
repository = "https://github.com/Dlurak/moxide"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
Expand Down
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Moxide

Moxide is a powerful tmux session manager written in Rust. It simplifies the process of creating and managing complex tmux sessions, allowing you to define and control multiple windows and commands effortlessly.

## Features

- **Declarative and Extensible:** Define your sessions using simple YAML configuration files. Customize and extend your setup as needed.
- **Single Binary:** Moxide is distributed as a single binary. No runtime or interpreter is required, making it easy to install and run.
- **Projects, Templates, and Directories:** Unlike other session managers, Moxide supports directories, templates, and projects:
- **Directories:** Easily create named sessions based on the directory you're working in.
- **Templates:** Create reusable templates for common setups. For example, a JavaScript template could open `nvim` in one window and run `npm` commands in another.
- **Projects:** Combine directories with templates to streamline workflows. You can specify a template for a project or directly define the windows and commands needed.

## Installation

To install Moxide, use the following command:

```bash
cargo install moxide
```

## Configuration Files

Moxide uses simple YAML configuration files. For an example, you can view my personal Moxide configuration [here](https://github.com/Dlurak/Dotfiles/tree/master/moxide).

### Concepts

#### Directories

Directories allow you to create a named tmux session based on a specific directory, making it easy to create sessions for important directories.

#### Templates

Templates define the layout of windows, panes, and commands. They do not require a specific directory and can be customized for different programming languages or workflows. For example, a JavaScript template might open nvim in one window and run npm commands in another.

#### Projects

Projects combine directories and templates. You can specify a template to use with a directory or define the session setup directly within the project configuration. This flexibility helps you manage complex workflows more efficiently.

## License

Moxide is licensed under the GPL.

## Similar Projects

If you are exploring alternatives, you might find these similar tools useful:

- [Sesh](https://github.com/joshmedeski/sesh)
- [tmuxinator](https://github.com/tmuxinator/tmuxinator)
6 changes: 6 additions & 0 deletions src/cli/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ use clap::Parser;

#[derive(Parser, Debug)]
pub struct ListCli {
/// A formatter for projects, `{}` will be replaced with the name, if omitted only the name
/// will be used
#[arg(long = "format-project", short = 'p', alias = "fmt-proj")]
pub format_project: Option<String>,

/// A formatter for templates, `{}` will be replaced with the name, if omitted only the name
/// will be used
#[arg(long = "format-template", short = 't', alias = "fmt-temp")]
pub format_template: Option<String>,

/// A formatter for directories, `{}` will be replaced with the name, if omitted only the name
/// will be used
#[arg(long = "format-directory", short = 'd', alias = "fmt-dir")]
pub format_directory: Option<String>,
}
11 changes: 7 additions & 4 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@ pub enum Commands {
///
/// This command will initialize your config directories.
Init,
/// Manage directories in the context of muxmate and tmux
/// Manage directories in the context of moxide and tmux
///
/// This command provides functionalities to interact with tmux sessions based on directories.
#[command(alias = "dir", alias = "dirs", alias = "directories")]
Directory(directory::DirectoryCli),
/// Manage templates in the context of muxmate and tmux
/// Manage templates in the context of moxide and tmux
///
/// This command provides functionalities to interact with tmux sessions based on templates
#[command(alias = "temp", alias = "templ")]
Template(template::TemplateCli),

/// Manage projects in the context of moxide and tmux
///
/// This command provides functionalities to interact with tmux sessions based on projects
#[command(alias = "proj", alias = "projects")]
Project(project::ProjectCli),

/// List all moxide directories, templates and projecets
#[command(alias = "ls")]
List(list::ListCli),
}
3 changes: 3 additions & 0 deletions src/cli/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ pub struct ProjectCli {

#[derive(Subcommand, Debug)]
pub enum ProjectCommands {
/// List all projects
#[command(alias = "ls")]
List(ProjectListArgs),
/// Start a specific project
Start(ProjectStartArgs),
}

Expand All @@ -22,6 +24,7 @@ pub struct ProjectListArgs {

#[derive(Debug, Parser)]
pub struct ProjectStartArgs {
/// The name of the project as it's defined in the config
pub name: String,

/// Start the session detached
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{

pub fn get_config_dir() -> std::path::PathBuf {
match dirs::config_dir() {
Some(path) => path.join("muxmate"),
Some(path) => path.join("moxide"),
None => exit!(1, "Could not find a config directory"),
}
}
Expand Down

0 comments on commit 79dae9e

Please sign in to comment.