Sfoglia il codice sorgente

Show a list of used compiler features with the debug command

timvisee 7 anni fa
parent
commit
861b70dc6f
3 ha cambiato i file con 31 aggiunte e 2 eliminazioni
  1. 5 1
      README.md
  2. 7 1
      cli/src/action/debug.rs
  3. 19 0
      cli/src/util.rs

+ 5 - 1
README.md

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

+ 7 - 1
cli/src/action/debug.rs

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

+ 19 - 0
cli/src/util.rs

@@ -714,3 +714,22 @@ pub fn app_history_file_path_string() -> String {
 pub fn env_var_present(key: impl AsRef<OsStr>) -> bool {
 pub fn env_var_present(key: impl AsRef<OsStr>) -> bool {
     var_os(key).is_some()
     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
+}