mirror of
https://github.com/avitex/rcon-cmd
synced 2024-12-03 16:29:58 +00:00
Release 1.0
This commit is contained in:
commit
f78a10a034
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
target
|
||||
Cargo.lock
|
8
Cargo.toml
Normal file
8
Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "rcon-cmd"
|
||||
version = "1.0.0"
|
||||
authors = ["James Dyson <theavitex@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
rcon = "*"
|
||||
clap = "*"
|
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 James Dyson
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
13
README.md
Normal file
13
README.md
Normal file
@ -0,0 +1,13 @@
|
||||
rcon-cmd
|
||||
======
|
||||
Simple command line tool to connect to a rcon enabled server and issue commands
|
||||
|
||||
## Usage
|
||||
```$ rcon host:port password```
|
||||
|
||||
#### Common useful commands
|
||||
| Command | Description |
|
||||
|------------|----------------------------------------------|
|
||||
| `status` | Retrieve the status of the host |
|
||||
| `find <?>` | Search for commands where (eg `find status`) |
|
||||
| `maps *` | List all maps hosted on server |
|
31
src/main.rs
Normal file
31
src/main.rs
Normal file
@ -0,0 +1,31 @@
|
||||
extern crate rcon;
|
||||
extern crate clap;
|
||||
|
||||
use clap::{App, Arg};
|
||||
|
||||
use std::io::stdin;
|
||||
use std::io::BufRead;
|
||||
|
||||
fn main() {
|
||||
let matches =
|
||||
App::new("rcon").about("rcon console tool")
|
||||
.arg(Arg::with_name("ADDR")
|
||||
.help("Server (HOST:PORT) to connect to")
|
||||
.index(1)
|
||||
.required(true))
|
||||
.arg(Arg::with_name("PASS")
|
||||
.help("Password to authenicate with")
|
||||
.index(2))
|
||||
.get_matches();
|
||||
|
||||
let mut conn = rcon::Connection::connect(
|
||||
matches.value_of("ADDR").unwrap(),
|
||||
matches.value_of("PASS").unwrap_or("")
|
||||
).expect("failed to connect to server");
|
||||
|
||||
let stdin = stdin();
|
||||
for line in stdin.lock().lines() {
|
||||
let line = line.unwrap();
|
||||
println!("{}", conn.cmd(&line[..]).unwrap());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user