Show a list of used compiler features with the debug command

This commit is contained in:
timvisee 2018-05-18 10:13:40 +02:00
parent 169c6c5387
commit 861b70dc6f
No known key found for this signature in database
GPG key ID: A28432A0AE6E6306
3 changed files with 31 additions and 2 deletions

View file

@ -121,6 +121,9 @@ Use the `--help` flag, or see the [help](#help) section for all available subcom
- Internet connection for uploading and downloading
## Install
<!-- Before installing, make sure you meet all requirements listed
[here](#requirements) -->
Because `ffsend` is still in alpha, no prebuilt binaries or repositories are
available at this time.
Build and install `ffsend` yourself using these fairly easy steps [here](#build).
@ -132,13 +135,14 @@ before proceeding:
### Build requirements
- Regular [requirements](#requirements)
- [`git`][git]
- [`rust`][rust] `v1.lt26` or higher (install using [`rustup`][rustup])
- [`rust`][rust] `v1.26` or higher (install using [`rustup`][rustup])
- [OpenSSL][openssl] or [LibreSSL][libressl] libraries and headers must be available
- Linux:
- Ubuntu/Debian: `apt install pkg-config libssl-dev`
- CentOS/Red Hat/openSUSE: `yum install openssl-devel`
- Arch: `pacman -S openssl`
- Fedora: `dnf install openssl-devel`
- Or see instructions [here](https://github.com/sfackler/rust-openssl#linux)
- macOS:
- Using `brew`: `brew install openssl`
- Or see instructions [here](https://github.com/sfackler/rust-openssl#osx)

View file

@ -14,7 +14,7 @@ use cmd::matcher::{
Matcher,
};
use error::ActionError;
use util::{format_bool, format_duration};
use util::{features_list, format_bool, format_duration};
/// A file debug action.
pub struct Debug<'a> {
@ -59,6 +59,12 @@ impl<'a> Debug<'a> {
Cell::new(&format_duration(Duration::seconds(SEND_DEFAULT_EXPIRE_TIME))),
]));
// Render a list of compiled features
table.add_row(Row::new(vec![
Cell::new("Features:"),
Cell::new(&features_list().join(", ")),
]));
// Show whether verbose is used
table.add_row(Row::new(vec![
Cell::new("Verbose:"),

View file

@ -714,3 +714,22 @@ pub fn app_history_file_path_string() -> String {
pub fn env_var_present(key: impl AsRef<OsStr>) -> bool {
var_os(key).is_some()
}
/// Get a list of all features that were enabled during compilation.
pub fn features_list() -> Vec<&'static str> {
// Build the list
#[allow(unused_mut)]
let mut features = Vec::new();
// Add each feature
#[cfg(feature = "archive")]
features.push("archive");
#[cfg(feature = "clipboard")]
features.push("clipboard");
#[cfg(feature = "history")]
features.push("history");
#[cfg(feature = "no-color")]
features.push("no-color");
features
}