mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-15 19:28:00 +01:00
Add --quiet option to rec command (closes #122)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
## master
|
||||
|
||||
* Added ability to replay asciicast from stdin by passing "-" as filename
|
||||
* `-q/--quiet` option added to `rec` command
|
||||
|
||||
## 1.1.1 (2015-06-21)
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ Available options:
|
||||
* `-t, --title=<title>` - Specify the title of the asciicast
|
||||
* `-w, --max-wait=<sec>` - Reduce recorded terminal inactivity to max <sec> seconds
|
||||
* `-y, --yes` - Answer "yes" to all prompts (e.g. upload confirmation)
|
||||
* `-q, --quiet` - Be quiet, suppress all notices/warnings (implies -y)
|
||||
|
||||
### `play <filename>`
|
||||
|
||||
|
||||
11
main.go
11
main.go
@@ -17,7 +17,7 @@ const Version = "1.1.1"
|
||||
var usage = `Record and share your terminal sessions, the right way.
|
||||
|
||||
Usage:
|
||||
asciinema rec [-c <command>] [-t <title>] [-w <sec>] [-y] [<filename>]
|
||||
asciinema rec [-c <command>] [-t <title>] [-w <sec>] [-y] [-q] [<filename>]
|
||||
asciinema play [-w <sec>] <filename>
|
||||
asciinema upload <filename>
|
||||
asciinema auth
|
||||
@@ -34,7 +34,8 @@ Options:
|
||||
-c, --command=<command> Specify command to record, defaults to $SHELL
|
||||
-t, --title=<title> Specify title of the asciicast
|
||||
-w, --max-wait=<sec> Reduce recorded terminal inactivity to max <sec> seconds
|
||||
-y, --yes Answer yes to all prompts (e.g. upload confirmation)
|
||||
-y, --yes Answer "yes" to all prompts (e.g. upload confirmation)
|
||||
-q, --quiet Be quiet, suppress all notices/warnings (implies -y)
|
||||
-h, --help Show this message
|
||||
--version Show version`
|
||||
|
||||
@@ -113,6 +114,12 @@ func main() {
|
||||
command := util.FirstNonBlank(stringArg(args, "--command"), cfg.RecordCommand())
|
||||
title := stringArg(args, "--title")
|
||||
assumeYes := cfg.RecordYes() || boolArg(args, "--yes")
|
||||
|
||||
if boolArg(args, "--quiet") {
|
||||
util.BeQuiet()
|
||||
assumeYes = true
|
||||
}
|
||||
|
||||
maxWait := uintArg(args, "--max-wait", cfg.RecordMaxWait())
|
||||
filename := stringArg(args, "<filename>")
|
||||
cmd := commands.NewRecordCommand(api, env)
|
||||
|
||||
@@ -46,6 +46,9 @@ reduce recorded terminal inactivity to max <sec> seconds
|
||||
.TP
|
||||
\-y, \-\-yes
|
||||
answer "yes" to all prompts (e.g. upload confirmation)
|
||||
.TP
|
||||
\-q, \-\-quiet
|
||||
be quiet, suppress all notices/warnings (implies -y)
|
||||
.RE
|
||||
.RE
|
||||
.PP
|
||||
|
||||
17
util/echo.go
17
util/echo.go
@@ -1,11 +1,22 @@
|
||||
package util
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
var loggerOutput io.Writer = os.Stdout
|
||||
|
||||
func BeQuiet() {
|
||||
loggerOutput = ioutil.Discard
|
||||
}
|
||||
|
||||
func Printf(s string, args ...interface{}) {
|
||||
fmt.Printf("\x1b[32m~ %v\x1b[0m\n", fmt.Sprintf(s, args...))
|
||||
fmt.Fprintf(loggerOutput, "\x1b[32m~ %v\x1b[0m\n", fmt.Sprintf(s, args...))
|
||||
}
|
||||
|
||||
func Warningf(s string, args ...interface{}) {
|
||||
fmt.Printf("\x1b[33m~ %v\x1b[0m\n", fmt.Sprintf(s, args...))
|
||||
fmt.Fprintf(loggerOutput, "\x1b[33m~ %v\x1b[0m\n", fmt.Sprintf(s, args...))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user