Improve archive name derivation, disable boolean env vars, hide env values

This commit is contained in:
timvisee 2018-05-17 17:20:11 +02:00
parent 36c8c355d2
commit a644792259
No known key found for this signature in database
GPG key ID: 109CBA0BF74036C2
6 changed files with 12 additions and 12 deletions

View file

@ -12,10 +12,12 @@ toolchain.
## Environment variables
- `FFSEND_HOST`: upload host (string)
- `FFSEND_HISTORY`: history file path (string)
Temporarily disabled:
- `FFSEND_FORCE`: upload host (present/boolean)
- `FFSEND_NO_INTERACT`: upload host (present/boolean)
- `FFSEND_YES`: upload host (present/boolean)
- `FFSEND_HISTORY`: history file path (string)
- `FFSEND_INCOGNITO`: incognito mode (present/boolean)
- `FFSEND_OPEN`: open an uploaded file (present/boolean)
- `FFSEND_ARCHIVE`: enable file archival (present/boolean)

View file

@ -30,6 +30,7 @@ Features:
- Allow piping input/output files
- Allow hiding the progress bar, and/or showing simple progress (with `-q`)
- Implement a quiet `-q` mode
- Update all dependencies
- Check all TODOs, solve them when possible
# Future releases

View file

@ -159,8 +159,10 @@ impl<'a> Upload<'a> {
if file_name.is_none() {
// TODO: use canonical path here
file_name = Some(
path.file_name()
.ok_or(ArchiveError::FileName)?
path.canonicalize()
.map_err(|err| ArchiveError::FileName(Some(err)))?
.file_name()
.ok_or(ArchiveError::FileName(None))?
.to_str()
.map(|s| s.to_owned())
.expect("failed to create string from file name")
@ -273,7 +275,7 @@ pub enum ArchiveError {
/// Failed to infer a file name for the archive.
#[fail(display = "failed to infer a file name for the archive")]
FileName,
FileName(Option<IoError>),
/// Failed to add a file or directory to the archive.
#[fail(display = "failed to add file to the archive")]

View file

@ -22,6 +22,7 @@ impl CmdArg for ArgHost {
.value_name("URL")
.default_value(SEND_DEFAULT_HOST)
.env("FFSEND_HOST")
.hide_env_values(true)
.help("The remote host to upload to")
}
}

View file

@ -62,21 +62,18 @@ impl<'a: 'b, 'b> Handler<'a> {
.long("force")
.short("f")
.global(true)
.env("FFSEND_FORCE")
.help("Force the action, ignore warnings"))
.arg(Arg::with_name("no-interact")
.long("no-interact")
.short("I")
.alias("no-interactive")
.global(true)
.env("FFSEND_NO_INTERACT")
.help("Not interactive, do not prompt"))
.arg(Arg::with_name("yes")
.long("yes")
.short("y")
.alias("assume-yes")
.global(true)
.env("FFSEND_YES")
.help("Assume yes for prompts"))
.subcommand(CmdDebug::build())
.subcommand(CmdDelete::build())
@ -96,8 +93,9 @@ impl<'a: 'b, 'b> Handler<'a> {
.global(true)
.help("Use the specified history file")
.default_value(&DEFAULT_HISTORY_FILE)
.hide_default_value(true)
.env("FFSEND_HISTORY")
.hide_default_value(true))
.hide_env_values(true))
.arg(Arg::with_name("incognito")
.long("incognito")
.short("i")
@ -105,7 +103,6 @@ impl<'a: 'b, 'b> Handler<'a> {
.alias("private")
.alias("priv")
.global(true)
.env("FFSEND_INCOGNITO")
.help("Don't update local history for actions"))
.subcommand(CmdHistory::build());

View file

@ -35,7 +35,6 @@ impl CmdUpload {
.arg(Arg::with_name("open")
.long("open")
.short("o")
.env("FFSEND_OPEN")
.help("Open the share link in your browser"));
// Optional archive support
@ -44,7 +43,6 @@ impl CmdUpload {
.long("archive")
.short("a")
.alias("arch")
.env("FFSEND_ARCHIVE")
.help("Package the file as an archive"))
}
@ -53,7 +51,6 @@ impl CmdUpload {
cmd = cmd.arg(Arg::with_name("copy")
.long("copy")
.short("c")
.env("FFSEND_COPY")
.help("Copy the share link to your clipboard"));
}
cmd