|
@@ -4,7 +4,7 @@ use std::io;
|
4
|
4
|
|
5
|
5
|
use crate::client::{build_url_from_config, create_snippet, OutgoingSnippet, ServerConfig};
|
6
|
6
|
|
7
|
|
-fn get_snippet_from_matches(matches: &ArgMatches) -> io::Result<OutgoingSnippet> {
|
|
7
|
+fn build_snippet_from_matches(matches: &ArgMatches) -> io::Result<OutgoingSnippet> {
|
8
|
8
|
let title = matches.value_of("name").unwrap();
|
9
|
9
|
let input = matches.value_of("file");
|
10
|
10
|
let filetype = matches.value_of("filetype").unwrap();
|
|
@@ -25,7 +25,7 @@ fn get_snippet_from_matches(matches: &ArgMatches) -> io::Result<OutgoingSnippet>
|
25
|
25
|
})
|
26
|
26
|
}
|
27
|
27
|
|
28
|
|
-fn get_server_config_from_matches(matches: &ArgMatches) -> ServerConfig {
|
|
28
|
+fn build_server_config_from_matches(matches: &ArgMatches) -> ServerConfig {
|
29
|
29
|
let protocol = matches.value_of("protocol").unwrap();
|
30
|
30
|
let hostname = matches.value_of("hostname").unwrap();
|
31
|
31
|
let port = matches.value_of("port").unwrap();
|
|
@@ -37,8 +37,8 @@ fn get_server_config_from_matches(matches: &ArgMatches) -> ServerConfig {
|
37
|
37
|
}
|
38
|
38
|
|
39
|
39
|
pub fn new_snippet(matches: &ArgMatches) -> io::Result<()> {
|
40
|
|
- let snippet = get_snippet_from_matches(matches)?;
|
41
|
|
- let config = get_server_config_from_matches(matches);
|
|
40
|
+ let snippet = build_snippet_from_matches(matches)?;
|
|
41
|
+ let config = build_server_config_from_matches(matches);
|
42
|
42
|
let url = build_url_from_config(&config);
|
43
|
43
|
|
44
|
44
|
match create_snippet(snippet, &config) {
|