Skip to content

Commit 78a7771

Browse files
committed
Add a freeze command
1 parent 18c0ec1 commit 78a7771

File tree

10 files changed

+384
-43
lines changed

10 files changed

+384
-43
lines changed

Cargo.lock

Lines changed: 18 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "moxide"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
edition = "2021"
55
license = "GPL-3.0-only"
66
readme = "README.md"
@@ -16,3 +16,4 @@ clap = { version = "4.5.16", features = ["derive"] }
1616
dirs = "5.0.1"
1717
colored = "2.1.0"
1818
tmux_interface = "0.3.2"
19+
itertools = "0.14.0"

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ Moxide offers a unique combination of features:
3333

3434
- **Reusable Templates**: Easily define a session once and apply it across multiple projects, making it ideal for managing similar setups.
3535
- **Flexibility**: Choose whether to use a template or define project-specific configurations, allowing for customization when needed.
36-
- **Declarative Configuration**: Use simple YAML files for configuration, promoting readability and ease of management.
36+
- **Declarative Configuration**: Use simple YAML files for configuration, promoting readability and ease of management, it can even be generated from an active session.
3737

3838
Here are some scenarios how moxide might help people:
3939

40-
- Developers managing multiple projects that require similar setups.
40+
- Developers managing multiple projects that require similar setups (For example 5 JavaScript projects, where only the directory differs).
4141
- Teams looking for a standardized tmux environment across shared codebases.
4242
- Individuals who appreciate the flexibility of reusing templates while maintaining the option for custom project configurations.
4343

@@ -140,9 +140,7 @@ value=$(echo "$list" | \
140140
--color=selected-bg:#45475a
141141
)
142142
143-
emoji="${value:0:1}"
144-
name="${value:2}"
145-
143+
IFS=' ' read -r emoji name <<< "$value"
146144
case "$emoji" in
147145
$project_emoji)
148146
moxide project start "$name"
@@ -158,7 +156,7 @@ esac
158156
You can bind this script into a tmux popup with the following command:
159157

160158
```tmux
161-
bind-key s display-popup -B -E -w 40% -h 12 "~/Dotfiles/scripts/shell/moxide.sh"
159+
bind-key s display-popup -B -E -w 40% -h 13 "~/Dotfiles/scripts/shell/moxide.sh"
162160
```
163161

164162
## Similar Projects

src/cli/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,20 @@ pub enum Commands {
3737
/// List all moxide directories, templates and projecets
3838
#[command(alias = "ls")]
3939
List(list::ListCli),
40+
/// Save the current session into a new template
41+
#[command(alias = "save")]
42+
Freeze {
43+
/// The name of the saved session, if none is provided the most used directory is used
44+
#[arg(short = 'n', long)]
45+
name: Option<String>,
46+
/// The name of the new file
47+
#[arg(long, group = "file")]
48+
file_name: Option<String>,
49+
/// Force overwrite existing files
50+
#[arg(short, long, default_value_t = false, group = "file")]
51+
force: bool,
52+
/// Use stdout instead of a file
53+
#[arg(long, default_value_t = false, conflicts_with = "file")]
54+
stdout: bool,
55+
},
4056
}

0 commit comments

Comments
 (0)