Skip to content

Commit

Permalink
Add -quiet flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Heckel committed Dec 8, 2020
1 parent c493788 commit b02ccbb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ pcopy is cross-machine clipboard that allows copying (`pcp < file.txt`) and past
across different computers. Other users can be invited to join (`pcopy invite`), or simply join by specifying
the hostname (`pcopy join`). Clipboards can have passwords, or they can be open for everyone.

![Demo](assets/demo.gif)

## Installation
Binaries can be found on the [releases page](https://github.com/binwiederhier/pcopy/releases). Alternatively, for a quick install, run:
```bash
Expand Down
Binary file added assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions cmd/pcopy/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func execJoin(args []string) {
flags.Usage = func() { showJoinUsage(flags) }
force := flags.Bool("force", false, "Overwrite config if it already exists")
auto := flags.Bool("auto", false, "Automatically choose clipboard alias")
quiet := flags.Bool("quiet", false, "Don't print instructions")
if err := flags.Parse(args); err != nil {
fail(err)
}
Expand Down Expand Up @@ -103,7 +104,9 @@ func execJoin(args []string) {
}
}

printInstructions(configFile, clipboard, info)
if !*quiet {
printInstructions(configFile, clipboard, info)
}
}

func readPassword() []byte {
Expand All @@ -123,9 +126,9 @@ func printInstructions(configFile string, clipboard string, info *pcopy.Info) {
}

if clipboard == pcopy.DefaultClipboard {
fmt.Printf("Successfully joined clipboard, config written to %s\n", configFile)
fmt.Printf("Successfully joined clipboard, config written to %s\n", pcopy.CollapseHome(configFile))
} else {
fmt.Printf("Successfully joined clipboard as alias '%s', config written to %s\n", clipboard, configFile)
fmt.Printf("Successfully joined clipboard as alias '%s', config written to %s\n", clipboard, pcopy.CollapseHome(configFile))
}

if info.Certs != nil {
Expand Down

0 comments on commit b02ccbb

Please sign in to comment.