Add version subcommand to determine remote server API version

This commit is contained in:
timvisee 2019-02-26 15:28:13 +01:00
parent 7c1429e112
commit f53f11a9f1
No known key found for this signature in database
GPG key ID: B8DB720BC383E172
9 changed files with 143 additions and 4 deletions

View file

@ -6,12 +6,13 @@ use clap::{App, AppSettings, Arg, ArgMatches};
use super::matcher::HistoryMatcher;
use super::matcher::{
DebugMatcher, DeleteMatcher, DownloadMatcher, ExistsMatcher, InfoMatcher, Matcher,
ParamsMatcher, PasswordMatcher, UploadMatcher,
ParamsMatcher, PasswordMatcher, UploadMatcher, VersionMatcher,
};
#[cfg(feature = "history")]
use super::subcmd::CmdHistory;
use super::subcmd::{
CmdDebug, CmdDelete, CmdDownload, CmdExists, CmdInfo, CmdParams, CmdPassword, CmdUpload,
CmdVersion,
};
use crate::config::{CLIENT_TIMEOUT, CLIENT_TRANSFER_TIMEOUT};
#[cfg(feature = "history")]
@ -145,7 +146,8 @@ impl<'a: 'b, 'b> Handler<'a> {
.subcommand(CmdInfo::build())
.subcommand(CmdParams::build())
.subcommand(CmdPassword::build())
.subcommand(CmdUpload::build().display_order(1));
.subcommand(CmdUpload::build().display_order(1))
.subcommand(CmdVersion::build());
// With history support, a flag for the history file and incognito mode
#[cfg(feature = "history")]
@ -239,4 +241,9 @@ impl<'a: 'b, 'b> Handler<'a> {
pub fn upload(&'a self) -> Option<UploadMatcher> {
UploadMatcher::with(&self.matches)
}
/// Get the version sub command, if matched.
pub fn version(&'a self) -> Option<VersionMatcher> {
VersionMatcher::with(&self.matches)
}
}