Do not use empty binary names

This commit is contained in:
timvisee 2019-03-25 17:40:53 +01:00
parent f6bf067ff3
commit 32e0e1c48f
No known key found for this signature in database
GPG key ID: B8DB720BC383E172
2 changed files with 9 additions and 6 deletions

View file

@ -111,6 +111,7 @@ Expiry: 18h2m (64928s)
``` ```
Other commands include: Other commands include:
```bash ```bash
# View your file history # View your file history
$ ffsend history $ ffsend history
@ -147,9 +148,6 @@ all available subcommands.
- OpenSSL: `brew install openssl@1.1` - OpenSSL: `brew install openssl@1.1`
## Install ## Install
<!-- Before installing, make sure you meet all requirements listed
[here](#requirements) -->
Because `ffsend` is still in alpha, only limited installation options are Because `ffsend` is still in alpha, only limited installation options are
available right now. available right now.
@ -199,8 +197,8 @@ ffsend --help
#### Linux: Nix package #### Linux: Nix package
_Note: The Nix package is currently not automatically updated, therefore it _Note: The Nix package is currently not automatically updated, therefore it
might be slightly outdated. Open an issue if you believe an important new might be slightly outdated. Open an issue if you believe an important update
feature is missing._ is missing._
```bash ```bash
nix-channel --update nix-channel --update
@ -341,10 +339,14 @@ docker run --rm -it -v $(pwd):/data timvisee/ffsend download https://send.firefo
# Show help # Show help
docker run --rm -it -v $(pwd):/data timvisee/ffsend help docker run --rm -it -v $(pwd):/data timvisee/ffsend help
# To update the used image
docker pull timvisee/ffsend
``` ```
On Linux or macOS you might define a alias in your shell configuration, to make On Linux or macOS you might define a alias in your shell configuration, to make
it invokable as `ffsend`: it invokable as `ffsend`:
```bash ```bash
alias ffsend='docker run --rm -it -v "$(pwd):/data" timvisee/ffsend' alias ffsend='docker run --rm -it -v "$(pwd):/data" timvisee/ffsend'
``` ```

View file

@ -755,7 +755,8 @@ pub fn format_bool(b: bool) -> &'static str {
pub fn bin_name() -> String { pub fn bin_name() -> String {
env::args_os() env::args_os()
.next() .next()
.map(|path| PathBuf::from(path)) .filter(|path| !path.is_empty())
.map(PathBuf::from)
.or_else(|| current_exe().ok()) .or_else(|| current_exe().ok())
.and_then(|p| p.file_name().map(|n| n.to_owned())) .and_then(|p| p.file_name().map(|n| n.to_owned()))
.and_then(|n| n.into_string().ok()) .and_then(|n| n.into_string().ok())