Compare commits
4 commits
1cd451ae72
...
87d8f0ad04
Author | SHA1 | Date | |
---|---|---|---|
87d8f0ad04 | |||
72eff2b654 | |||
b98c0fc993 | |||
f223e0417c |
5 changed files with 27 additions and 4 deletions
|
@ -184,7 +184,7 @@ func NewCreateExecutor(
|
||||||
exe.BoolVar(&exe.pollHidesVoteCounts, "poll-hides-vote-counts", false, "Set to true to hide the vote count until the poll is closed")
|
exe.BoolVar(&exe.pollHidesVoteCounts, "poll-hides-vote-counts", false, "Set to true to hide the vote count until the poll is closed")
|
||||||
exe.Var(&exe.pollOptions, "poll-option", "A poll option. Use this multiple times to set multiple options")
|
exe.Var(&exe.pollOptions, "poll-option", "A poll option. Use this multiple times to set multiple options")
|
||||||
exe.Var(&exe.sensitive, "sensitive", "Set to true if the status should be marked as sensitive")
|
exe.Var(&exe.sensitive, "sensitive", "Set to true if the status should be marked as sensitive")
|
||||||
exe.StringVar(&exe.spoilerText, "spoiler-text", "", "The text to display as the status' warning or subject")
|
exe.StringVar(&exe.spoilerText, "spoiler-text", "", "The subject, summary or content warning for the status")
|
||||||
exe.StringVar(&exe.resourceType, "type", "", "The type of resource you want to action on (e.g. account, status)")
|
exe.StringVar(&exe.resourceType, "type", "", "The type of resource you want to action on (e.g. account, status)")
|
||||||
exe.StringVar(&exe.visibility, "visibility", "", "The visibility of the posted status")
|
exe.StringVar(&exe.visibility, "visibility", "", "The visibility of the posted status")
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ type Status struct {
|
||||||
ReblogsCount int `json:"reblogs_count"`
|
ReblogsCount int `json:"reblogs_count"`
|
||||||
RepliesCount int `json:"replies_count"`
|
RepliesCount int `json:"replies_count"`
|
||||||
Sensitive bool `json:"sensitive"`
|
Sensitive bool `json:"sensitive"`
|
||||||
SpolierText string `json:"spoiler_text"`
|
SpoilerText string `json:"spoiler_text"`
|
||||||
Tags []Tag `json:"tags"`
|
Tags []Tag `json:"tags"`
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
URI string `json:"uri"`
|
URI string `json:"uri"`
|
||||||
|
@ -83,7 +83,7 @@ type StatusReblogged struct {
|
||||||
RebloggsCount int `json:"reblogs_count"`
|
RebloggsCount int `json:"reblogs_count"`
|
||||||
RepliesCount int `json:"replies_count"`
|
RepliesCount int `json:"replies_count"`
|
||||||
Sensitive bool `json:"sensitive"`
|
Sensitive bool `json:"sensitive"`
|
||||||
SpolierText string `json:"spoiler_text"`
|
SpoilerText string `json:"spoiler_text"`
|
||||||
Tags []Tag `json:"tags"`
|
Tags []Tag `json:"tags"`
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
URI string `json:"uri"`
|
URI string `json:"uri"`
|
||||||
|
|
|
@ -27,6 +27,7 @@ const (
|
||||||
|
|
||||||
type theme struct {
|
type theme struct {
|
||||||
reset string
|
reset string
|
||||||
|
bold string
|
||||||
boldblue string
|
boldblue string
|
||||||
boldmagenta string
|
boldmagenta string
|
||||||
green string
|
green string
|
||||||
|
@ -53,6 +54,7 @@ func NewPrinter(
|
||||||
) *Printer {
|
) *Printer {
|
||||||
theme := theme{
|
theme := theme{
|
||||||
reset: "\033[0m",
|
reset: "\033[0m",
|
||||||
|
bold: "\033[1m",
|
||||||
boldblue: "\033[34;1m",
|
boldblue: "\033[34;1m",
|
||||||
boldmagenta: "\033[35;1m",
|
boldmagenta: "\033[35;1m",
|
||||||
green: "\033[32m",
|
green: "\033[32m",
|
||||||
|
@ -115,6 +117,14 @@ func (p Printer) fieldFormat(text string) string {
|
||||||
return p.theme.green + text + p.theme.reset
|
return p.theme.green + text + p.theme.reset
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p Printer) bold(text string) string {
|
||||||
|
if p.noColor {
|
||||||
|
return text
|
||||||
|
}
|
||||||
|
|
||||||
|
return p.theme.bold + text + p.theme.reset
|
||||||
|
}
|
||||||
|
|
||||||
func (p Printer) fullDisplayNameFormat(displayName, acct string) string {
|
func (p Printer) fullDisplayNameFormat(displayName, acct string) string {
|
||||||
// use this pattern to remove all emoji strings
|
// use this pattern to remove all emoji strings
|
||||||
pattern := regexp.MustCompile(`\s:[A-Za-z0-9_]*:`)
|
pattern := regexp.MustCompile(`\s:[A-Za-z0-9_]*:`)
|
||||||
|
|
|
@ -18,6 +18,12 @@ func (p Printer) PrintStatus(status model.Status, userAccountID string) {
|
||||||
builder.WriteString("\n\n" + p.headerFormat("STATUS ID:"))
|
builder.WriteString("\n\n" + p.headerFormat("STATUS ID:"))
|
||||||
builder.WriteString("\n" + status.ID)
|
builder.WriteString("\n" + status.ID)
|
||||||
|
|
||||||
|
// The subject, summary of content warning of the status
|
||||||
|
if status.SpoilerText != "" {
|
||||||
|
builder.WriteString("\n\n" + p.headerFormat("SUMMARY:"))
|
||||||
|
builder.WriteString("\n" + status.SpoilerText)
|
||||||
|
}
|
||||||
|
|
||||||
// The content of the status.
|
// The content of the status.
|
||||||
builder.WriteString("\n\n" + p.headerFormat("CONTENT:"))
|
builder.WriteString("\n\n" + p.headerFormat("CONTENT:"))
|
||||||
builder.WriteString(p.convertHTMLToText(status.Content, true))
|
builder.WriteString(p.convertHTMLToText(status.Content, true))
|
||||||
|
@ -97,6 +103,7 @@ func (p Printer) statusList(list model.StatusList, userAccountID string) string
|
||||||
content := status.Content
|
content := status.Content
|
||||||
poll := status.Poll
|
poll := status.Poll
|
||||||
mediaAttachments := status.MediaAttachments
|
mediaAttachments := status.MediaAttachments
|
||||||
|
summary := status.SpoilerText
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case status.Reblog != nil:
|
case status.Reblog != nil:
|
||||||
|
@ -115,6 +122,8 @@ func (p Printer) statusList(list model.StatusList, userAccountID string) string
|
||||||
content = status.Reblog.Content
|
content = status.Reblog.Content
|
||||||
poll = status.Reblog.Poll
|
poll = status.Reblog.Poll
|
||||||
mediaAttachments = status.Reblog.MediaAttachments
|
mediaAttachments = status.Reblog.MediaAttachments
|
||||||
|
summary = status.Reblog.SpoilerText
|
||||||
|
|
||||||
case status.InReplyToID != "":
|
case status.InReplyToID != "":
|
||||||
builder.WriteString("\n" + p.wrapLines(
|
builder.WriteString("\n" + p.wrapLines(
|
||||||
p.fullDisplayNameFormat(status.Account.DisplayName, status.Account.Acct)+
|
p.fullDisplayNameFormat(status.Account.DisplayName, status.Account.Acct)+
|
||||||
|
@ -127,6 +136,10 @@ func (p Printer) statusList(list model.StatusList, userAccountID string) string
|
||||||
builder.WriteString("\n" + p.fullDisplayNameFormat(status.Account.DisplayName, status.Account.Acct) + " posted:")
|
builder.WriteString("\n" + p.fullDisplayNameFormat(status.Account.DisplayName, status.Account.Acct) + " posted:")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if summary != "" {
|
||||||
|
builder.WriteString("\n\n" + p.bold(p.wrapLines(summary, 0)))
|
||||||
|
}
|
||||||
|
|
||||||
builder.WriteString("\n" + p.convertHTMLToText(content, true))
|
builder.WriteString("\n" + p.convertHTMLToText(content, true))
|
||||||
|
|
||||||
if poll != nil {
|
if poll != nil {
|
||||||
|
|
|
@ -174,7 +174,7 @@
|
||||||
},
|
},
|
||||||
"spoiler-text": {
|
"spoiler-text": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The text to display as the status' warning or subject"
|
"description": "The subject, summary or content warning for the status"
|
||||||
},
|
},
|
||||||
"status-id": {
|
"status-id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
Loading…
Reference in a new issue