Extensions might affect behavior in ways we can’t anticipate,
so just ignoring them is not correct.
Later we’ll add opt-in configuration to ignore specific extensions.
( )
| Alphare | |
| marmoute |
| hg-reviewers |
Extensions might affect behavior in ways we can’t anticipate,
so just ignoring them is not correct.
Later we’ll add opt-in configuration to ignore specific extensions.
| No Linters Available |
| No Unit Test Coverage |
| Path | Packages | |||
|---|---|---|---|---|
| M | rust/Cargo.lock (8 lines) | |||
| M | rust/hg-core/src/config/config.rs (9 lines) | |||
| M | rust/hg-core/src/config/layer.rs (8 lines) | |||
| M | rust/rhg/Cargo.toml (2 lines) | |||
| M | rust/rhg/src/main.rs (26 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| 6276a8ed5079 | 2089a14f384c | Simon Sapin | Mar 4 2021, 4:58 AM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | D10134 rhg: Add support for --cwd | |
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin | ||
| Closed | SimonSapin |
| "crc32fast 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | "crc32fast 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "libc 0.2.81 (registry+https://github.com/rust-lang/crates.io-index)", | "libc 0.2.81 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "libz-sys 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | "libz-sys 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "miniz_oxide 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", | "miniz_oxide 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ] | ||||
| [[package]] | [[package]] | ||||
| name = "format-bytes" | name = "format-bytes" | ||||
| version = "0.2.0" | version = "0.2.1" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| dependencies = [ | dependencies = [ | ||||
| "format-bytes-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", | "format-bytes-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", | "proc-macro-hack 0.5.19 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ] | ||||
| [[package]] | [[package]] | ||||
| name = "format-bytes-macros" | name = "format-bytes-macros" | ||||
| version = "0.1.0" | version = "0.1.0" | ||||
| dependencies = [ | dependencies = [ | ||||
| "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", | "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "bytes-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | "bytes-cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", | "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", | "crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "derive_more 0.99.11 (registry+https://github.com/rust-lang/crates.io-index)", | "derive_more 0.99.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "flate2 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", | "flate2 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "format-bytes 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | "format-bytes 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "home 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", | "home 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "im-rc 15.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | "im-rc 15.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", | "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "micro-timer 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | "micro-timer 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", | "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", | "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| [[package]] | [[package]] | ||||
| name = "rhg" | name = "rhg" | ||||
| version = "0.1.0" | version = "0.1.0" | ||||
| dependencies = [ | dependencies = [ | ||||
| "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", | "chrono 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", | "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "derive_more 0.99.11 (registry+https://github.com/rust-lang/crates.io-index)", | "derive_more 0.99.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", | "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "format-bytes 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | "format-bytes 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "hg-core 0.1.0", | "hg-core 0.1.0", | ||||
| "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "micro-timer 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | "micro-timer 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| "users 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", | "users 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
| ] | ] | ||||
| [[package]] | [[package]] | ||||
| name = "rust-crypto" | name = "rust-crypto" | ||||
| "checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" | "checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" | ||||
| "checksum crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" | "checksum crossbeam-utils 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" | ||||
| "checksum ctor 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484" | "checksum ctor 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484" | ||||
| "checksum derive_more 0.99.11 (registry+https://github.com/rust-lang/crates.io-index)" = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c" | "checksum derive_more 0.99.11 (registry+https://github.com/rust-lang/crates.io-index)" = "41cb0e6161ad61ed084a36ba71fbba9e3ac5aee3606fb607fe08da6acbcf3d8c" | ||||
| "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" | "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" | ||||
| "checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" | "checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" | ||||
| "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" | "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" | ||||
| "checksum flate2 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "7411863d55df97a419aa64cb4d2f167103ea9d767e2c54a1868b7ac3f6b47129" | "checksum flate2 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "7411863d55df97a419aa64cb4d2f167103ea9d767e2c54a1868b7ac3f6b47129" | ||||
| "checksum format-bytes 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc35f5e45d6b31053cea13078ffc6fa52fa8617aa54b7ac2011720d9c009e04f" | "checksum format-bytes 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8030ff4b04f0ca1c612d6fe49f2fc18caf56fb01497cb370b41cfd36d89b3b06" | ||||
| "checksum format-bytes-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b05089e341a0460449e2210c3bf7b61597860b07f0deae58da38dbed0a4c6b6d" | "checksum format-bytes-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b05089e341a0460449e2210c3bf7b61597860b07f0deae58da38dbed0a4c6b6d" | ||||
| "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" | "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" | ||||
| "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" | "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" | ||||
| "checksum getrandom 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" | "checksum getrandom 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" | ||||
| "checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" | "checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" | ||||
| "checksum hermit-abi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" | "checksum hermit-abi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" | ||||
| "checksum home 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654" | "checksum home 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654" | ||||
| "checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" | "checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" | ||||
| // config.rs | // config.rs | ||||
| // | // | ||||
| // Copyright 2020 | // Copyright 2020 | ||||
| // Valentin Gatien-Baron, | // Valentin Gatien-Baron, | ||||
| // Raphaël Gomès <rgomes@octobus.net> | // Raphaël Gomès <rgomes@octobus.net> | ||||
| // | // | ||||
| // This software may be used and distributed according to the terms of the | // This software may be used and distributed according to the terms of the | ||||
| // GNU General Public License version 2 or any later version. | // GNU General Public License version 2 or any later version. | ||||
| use super::layer; | use super::layer; | ||||
| use super::values; | use super::values; | ||||
| use crate::config::layer::{ | use crate::config::layer::{ | ||||
| ConfigError, ConfigLayer, ConfigOrigin, ConfigValue, | ConfigError, ConfigLayer, ConfigOrigin, ConfigValue, | ||||
| }; | }; | ||||
| use crate::utils::files::get_bytes_from_os_str; | use crate::utils::files::get_bytes_from_os_str; | ||||
| use format_bytes::{write_bytes, DisplayBytes}; | use format_bytes::{write_bytes, DisplayBytes}; | ||||
| use std::collections::HashSet; | |||||
| use std::env; | use std::env; | ||||
| use std::path::{Path, PathBuf}; | use std::path::{Path, PathBuf}; | ||||
| use std::str; | use std::str; | ||||
| use crate::errors::{HgResultExt, IoResultExt}; | use crate::errors::{HgResultExt, IoResultExt}; | ||||
| /// Holds the config values for the current repository | /// Holds the config values for the current repository | ||||
| /// TODO update this docstring once we support more sources | /// TODO update this docstring once we support more sources | ||||
| } | } | ||||
| if let Some(v) = layer.get(§ion, &item) { | if let Some(v) = layer.get(§ion, &item) { | ||||
| return Some((&layer, v)); | return Some((&layer, v)); | ||||
| } | } | ||||
| } | } | ||||
| None | None | ||||
| } | } | ||||
| /// Return all keys defined for the given section | |||||
| pub fn get_section_keys(&self, section: &[u8]) -> HashSet<&[u8]> { | |||||
| self.layers | |||||
| .iter() | |||||
| .flat_map(|layer| layer.iter_keys(section)) | |||||
| .collect() | |||||
| } | |||||
| /// Get raw values bytes from all layers (even untrusted ones) in order | /// Get raw values bytes from all layers (even untrusted ones) in order | ||||
| /// of precedence. | /// of precedence. | ||||
| #[cfg(test)] | #[cfg(test)] | ||||
| fn get_all(&self, section: &[u8], item: &[u8]) -> Vec<&[u8]> { | fn get_all(&self, section: &[u8], item: &[u8]) -> Vec<&[u8]> { | ||||
| let mut res = vec![]; | let mut res = vec![]; | ||||
| for layer in self.layers.iter().rev() { | for layer in self.layers.iter().rev() { | ||||
| if let Some(v) = layer.get(§ion, &item) { | if let Some(v) = layer.get(§ion, &item) { | ||||
| res.push(v.bytes.as_ref()); | res.push(v.bytes.as_ref()); | ||||
| .insert(item, ConfigValue { bytes: value, line }); | .insert(item, ConfigValue { bytes: value, line }); | ||||
| } | } | ||||
| /// Returns the config value in `<section>.<item>` if it exists | /// Returns the config value in `<section>.<item>` if it exists | ||||
| pub fn get(&self, section: &[u8], item: &[u8]) -> Option<&ConfigValue> { | pub fn get(&self, section: &[u8], item: &[u8]) -> Option<&ConfigValue> { | ||||
| Some(self.sections.get(section)?.get(item)?) | Some(self.sections.get(section)?.get(item)?) | ||||
| } | } | ||||
| /// Returns the keys defined in the given section | |||||
| pub fn iter_keys(&self, section: &[u8]) -> impl Iterator<Item = &[u8]> { | |||||
| self.sections | |||||
| .get(section) | |||||
| .into_iter() | |||||
| .flat_map(|section| section.keys().map(|vec| &**vec)) | |||||
| } | |||||
| pub fn is_empty(&self) -> bool { | pub fn is_empty(&self) -> bool { | ||||
| self.sections.is_empty() | self.sections.is_empty() | ||||
| } | } | ||||
| /// Returns a `Vec` of layers in order of precedence (so, in read order), | /// Returns a `Vec` of layers in order of precedence (so, in read order), | ||||
| /// recursively parsing the `%include` directives if any. | /// recursively parsing the `%include` directives if any. | ||||
| pub fn parse(src: &Path, data: &[u8]) -> Result<Vec<Self>, ConfigError> { | pub fn parse(src: &Path, data: &[u8]) -> Result<Vec<Self>, ConfigError> { | ||||
| let mut layers = vec![]; | let mut layers = vec![]; | ||||
| [dependencies] | [dependencies] | ||||
| hg-core = { path = "../hg-core"} | hg-core = { path = "../hg-core"} | ||||
| chrono = "0.4.19" | chrono = "0.4.19" | ||||
| clap = "2.33.1" | clap = "2.33.1" | ||||
| derive_more = "0.99" | derive_more = "0.99" | ||||
| log = "0.4.11" | log = "0.4.11" | ||||
| micro-timer = "0.3.1" | micro-timer = "0.3.1" | ||||
| env_logger = "0.7.1" | env_logger = "0.7.1" | ||||
| format-bytes = "0.2.0" | format-bytes = "0.2.1" | ||||
| users = "0.11.0" | users = "0.11.0" | ||||
| extern crate log; | extern crate log; | ||||
| use crate::ui::Ui; | use crate::ui::Ui; | ||||
| use clap::App; | use clap::App; | ||||
| use clap::AppSettings; | use clap::AppSettings; | ||||
| use clap::Arg; | use clap::Arg; | ||||
| use clap::ArgMatches; | use clap::ArgMatches; | ||||
| use format_bytes::format_bytes; | use format_bytes::{format_bytes, join}; | ||||
| use hg::config::Config; | use hg::config::Config; | ||||
| use hg::repo::{Repo, RepoError}; | use hg::repo::{Repo, RepoError}; | ||||
| use hg::utils::files::{get_bytes_from_os_str, get_path_from_bytes}; | use hg::utils::files::{get_bytes_from_os_str, get_path_from_bytes}; | ||||
| use hg::utils::SliceExt; | use hg::utils::SliceExt; | ||||
| use std::ffi::OsString; | use std::ffi::OsString; | ||||
| use std::path::PathBuf; | use std::path::PathBuf; | ||||
| use std::process::Command; | use std::process::Command; | ||||
| mod blackbox; | mod blackbox; | ||||
| mod error; | mod error; | ||||
| mod exitcode; | mod exitcode; | ||||
| mod ui; | mod ui; | ||||
| use error::CommandError; | use error::CommandError; | ||||
| fn main_with_result( | fn main_with_result( | ||||
| process_start_time: &blackbox::ProcessStartTime, | process_start_time: &blackbox::ProcessStartTime, | ||||
| ui: &ui::Ui, | ui: &ui::Ui, | ||||
| repo: Result<&Repo, &NoRepoInCwdError>, | repo: Result<&Repo, &NoRepoInCwdError>, | ||||
| config: &Config, | config: &Config, | ||||
| ) -> Result<(), CommandError> { | ) -> Result<(), CommandError> { | ||||
| check_extensions(config)?; | |||||
| let app = App::new("rhg") | let app = App::new("rhg") | ||||
| .global_setting(AppSettings::AllowInvalidUtf8) | .global_setting(AppSettings::AllowInvalidUtf8) | ||||
| .setting(AppSettings::SubcommandRequired) | .setting(AppSettings::SubcommandRequired) | ||||
| .setting(AppSettings::VersionlessSubcommands) | .setting(AppSettings::VersionlessSubcommands) | ||||
| .arg( | .arg( | ||||
| Arg::with_name("repository") | Arg::with_name("repository") | ||||
| .help("repository root directory") | .help("repository root directory") | ||||
| .short("-R") | .short("-R") | ||||
| .get(b"rhg", b"fallback-executable") | .get(b"rhg", b"fallback-executable") | ||||
| .unwrap_or(Self::DEFAULT_FALLBACK_EXECUTABLE) | .unwrap_or(Self::DEFAULT_FALLBACK_EXECUTABLE) | ||||
| .to_owned(), | .to_owned(), | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| const SUPPORTED_EXTENSIONS: &[&[u8]] = &[b"blackbox", b"share"]; | |||||
| fn check_extensions(config: &Config) -> Result<(), CommandError> { | |||||
| let enabled = config.get_section_keys(b"extensions"); | |||||
| let mut unsupported = enabled; | |||||
| for supported in SUPPORTED_EXTENSIONS { | |||||
| unsupported.remove(supported); | |||||
| } | |||||
| if unsupported.is_empty() { | |||||
| Ok(()) | |||||
| } else { | |||||
| Err(CommandError::UnsupportedFeature { | |||||
| message: format_bytes!( | |||||
| b"extensions: {}", | |||||
| join(unsupported, b", ") | |||||
| ), | |||||
| }) | |||||
| } | |||||
| } | |||||