Skip to content

Commit f03847f

Browse files
committed
0.1.2 Release
This release adds the featue where rcon responces will be colored like how they are displayed ingame by adding my minecraft-formatting crate Also updates some deps
1 parent 7ed6012 commit f03847f

File tree

3 files changed

+25
-30
lines changed

3 files changed

+25
-30
lines changed

Cargo.lock

+16-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ tokio = { version = "0.2", features = ["rt-core"] }
2121
rustyline = "6.0.0"
2222
rpassword = "4.0.2"
2323
structopt = "0.3.12"
24-
directories = "2.0.2"
24+
directories-next = "1.0.1"
2525
scopeguard = "1.1.0"
26+
minecraft-formatting = "0.1.0"

src/main.rs

+7-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//!
88
//! You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
99
10-
use directories::ProjectDirs;
10+
use directories_next::ProjectDirs;
1111
use rustyline::error::ReadlineError;
1212
use rustyline::Editor;
1313
use std::error::Error;
@@ -70,22 +70,16 @@ fn main() -> Result<(), Box<dyn Error>> {
7070
))?;
7171
println!("{}", BANNER);
7272
loop {
73-
let readline = rl.readline("> ");
74-
match readline {
75-
Ok(quit) if quit == "Q" => {
73+
match rl.readline("> ") {
74+
Ok(quit) if quit.trim() == "Q" => {
7675
break;
7776
}
7877
Ok(line) => {
79-
rl.add_history_entry(line.as_str());
80-
let resp = match rt.block_on(rcon.cmd(&line)) {
81-
Ok(line) => line,
82-
Err(e) => {
83-
println!("backing up");
84-
return Err(Box::new(e));
85-
}
86-
};
78+
rl.add_history_entry(&line);
79+
let resp = rt.block_on(rcon.cmd(&line))?;
80+
8781
if !resp.is_empty() {
88-
println!("{}", resp);
82+
minecraft_formatting::formatting_tokenize(&resp).iter().for_each(|span| span.print());
8983
}
9084
}
9185
Err(ReadlineError::Interrupted) => {

0 commit comments

Comments
 (0)