Usage
This commit is contained in:
parent
ed42fb8b92
commit
577f689d27
|
@ -2,6 +2,10 @@ use data_encoding::Encoding;
|
|||
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
const EXTRA_USAGE: &'static str = r"The default alphabet is taken from RFC 4648, section 6.
|
||||
|
||||
Note this command will collect stream input.";
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct DecodeBase32;
|
||||
|
||||
|
@ -19,11 +23,11 @@ impl Command for DecodeBase32 {
|
|||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Decode a value."
|
||||
"Decode a Base32 value."
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
"TODO"
|
||||
EXTRA_USAGE
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
|
@ -80,17 +84,15 @@ impl Command for EncodeBase32 {
|
|||
])
|
||||
.allow_variants_without_examples(true)
|
||||
.switch("nopad", "Don't accept padding.", None)
|
||||
.switch("dnscurve", "Parse as the DNSCURVE Base32 variant.", None)
|
||||
.switch("dnssec", "Parse as the DNSSEC Base32 variant.", None)
|
||||
.category(Category::Formats)
|
||||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Encode a value."
|
||||
"Encode a string or binary value using Base32."
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
"TODO"
|
||||
EXTRA_USAGE
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
use nu_engine::command_prelude::*;
|
||||
|
||||
const EXTRA_USAGE: &'static str = r"This command uses an alternative Base32 alphabet, defined in RFC 4648, section 7.
|
||||
|
||||
Note this command will collect stream input.";
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct DecodeBase32Hex;
|
||||
|
||||
|
@ -20,11 +24,11 @@ impl Command for DecodeBase32Hex {
|
|||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Encode a value."
|
||||
"Encode a base32hex value."
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
"TODO"
|
||||
EXTRA_USAGE
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
|
@ -87,11 +91,11 @@ impl Command for EncodeBase32Hex {
|
|||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"Encode a value."
|
||||
"Encode a binary value or a string using base32hex."
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
"TODO"
|
||||
EXTRA_USAGE
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
|
|
|
@ -2,6 +2,10 @@ use data_encoding::Encoding;
|
|||
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
const EXTRA_USAGE: &'static str = r"The default alphabet is taken from RFC 4648, section 4. A URL-safe version is available.
|
||||
|
||||
Note this command will collect stream input.";
|
||||
|
||||
fn get_encoding_from_flags(url: bool, nopad: bool) -> Encoding {
|
||||
match (url, nopad) {
|
||||
(false, false) => data_encoding::BASE64,
|
||||
|
@ -47,11 +51,11 @@ impl Command for DecodeBase64 {
|
|||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"TODO"
|
||||
"Decode a Base64 value."
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
"TODO"
|
||||
EXTRA_USAGE
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
|
@ -105,11 +109,11 @@ impl Command for EncodeBase64 {
|
|||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"TODO"
|
||||
"Encode a string or binary value using Base64."
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
"TODO"
|
||||
EXTRA_USAGE
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
|
|
|
@ -16,11 +16,7 @@ impl Command for DecodeHex {
|
|||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"TODO"
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
"TODO"
|
||||
"Hex decode a value."
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
|
@ -71,11 +67,7 @@ impl Command for EncodeHex {
|
|||
}
|
||||
|
||||
fn usage(&self) -> &str {
|
||||
"TODO"
|
||||
}
|
||||
|
||||
fn extra_usage(&self) -> &str {
|
||||
"TODO"
|
||||
"Hex encode a binary value or a string."
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
|
|
Loading…
Reference in New Issue
Block a user