Skip to content

Commit

Permalink
[fmtc] Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
andyone committed Jul 14, 2023
1 parent 8785fd2 commit da798b6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* `[terminal]` Added method `InfoPanel` for showing panel with informative message
* `[terminal]` Method `PrintErrorMessage` marked as deprecated (_use method `Error` instead_)
* `[terminal]` Method `PrintWarnMessage` marked as deprecated (_use method `Warn` instead_)
* `[fmtc]` Code refactoring
* `[initsystem]` Code refactoring

### 12.69.0
Expand Down
40 changes: 20 additions & 20 deletions fmtc/cond_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func If(cond bool) CondWrapper {
// Print formats using the default formats for its operands and writes to standard
// output.
func (cw CondWrapper) Print(a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -38,7 +38,7 @@ func (cw CondWrapper) Print(a ...any) (int, error) {
// output. Spaces are always added between operands and a newline is appended. It
// returns the number of bytes written and any write error encountered.
func (cw CondWrapper) Println(a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -48,7 +48,7 @@ func (cw CondWrapper) Println(a ...any) (int, error) {
// Printf formats according to a format specifier and writes to standard output. It
// returns the number of bytes written and any write error encountered.
func (cw CondWrapper) Printf(f string, a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -59,7 +59,7 @@ func (cw CondWrapper) Printf(f string, a ...any) (int, error) {
// Spaces are added between operands when neither is a string. It returns the
// number of bytes written and any write error encountered.
func (cw CondWrapper) Fprint(w io.Writer, a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -70,7 +70,7 @@ func (cw CondWrapper) Fprint(w io.Writer, a ...any) (int, error) {
// Spaces are always added between operands and a newline is appended. It returns
// the number of bytes written and any write error encountered.
func (cw CondWrapper) Fprintln(w io.Writer, a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -80,7 +80,7 @@ func (cw CondWrapper) Fprintln(w io.Writer, a ...any) (int, error) {
// Fprintf formats according to a format specifier and writes to w. It returns
// the number of bytes written and any write error encountered.
func (cw CondWrapper) Fprintf(w io.Writer, f string, a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -90,7 +90,7 @@ func (cw CondWrapper) Fprintf(w io.Writer, f string, a ...any) (int, error) {
// Sprint formats using the default formats for its operands and returns the
// resulting string. Spaces are added between operands when neither is a string.
func (cw CondWrapper) Sprint(a ...any) string {
if cw.match == false {
if !cw.match {
return ""
}

Expand All @@ -100,7 +100,7 @@ func (cw CondWrapper) Sprint(a ...any) string {
// Sprintf formats according to a format specifier and returns the resulting
// string.
func (cw CondWrapper) Sprintf(f string, a ...any) string {
if cw.match == false {
if !cw.match {
return ""
}

Expand All @@ -111,7 +111,7 @@ func (cw CondWrapper) Sprintf(f string, a ...any) string {
// resulting string. Spaces are always added between operands and a newline is
// appended.
func (cw CondWrapper) Sprintln(a ...any) string {
if cw.match == false {
if !cw.match {
return ""
}

Expand All @@ -120,7 +120,7 @@ func (cw CondWrapper) Sprintln(a ...any) string {

// TPrint removes all content on the current line and prints the new message
func (cw CondWrapper) TPrint(a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -129,7 +129,7 @@ func (cw CondWrapper) TPrint(a ...any) (int, error) {

// TPrintf removes all content on the current line and prints the new message
func (cw CondWrapper) TPrintf(f string, a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -139,7 +139,7 @@ func (cw CondWrapper) TPrintf(f string, a ...any) (int, error) {
// TPrintln removes all content on the current line and prints the new message
// with a new line symbol at the end
func (cw CondWrapper) TPrintln(a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -149,7 +149,7 @@ func (cw CondWrapper) TPrintln(a ...any) (int, error) {
// LPrint formats using the default formats for its operands and writes to standard
// output limited by the text size
func (cw CondWrapper) LPrint(maxSize int, a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -159,7 +159,7 @@ func (cw CondWrapper) LPrint(maxSize int, a ...any) (int, error) {
// LPrintf formats according to a format specifier and writes to standard output
// limited by the text size
func (cw CondWrapper) LPrintf(maxSize int, f string, a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -169,7 +169,7 @@ func (cw CondWrapper) LPrintf(maxSize int, f string, a ...any) (int, error) {
// LPrintln formats using the default formats for its operands and writes to standard
// output limited by the text size
func (cw CondWrapper) LPrintln(maxSize int, a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -179,7 +179,7 @@ func (cw CondWrapper) LPrintln(maxSize int, a ...any) (int, error) {
// TLPrint removes all content on the current line and prints the new message
// limited by the text size
func (cw CondWrapper) TLPrint(maxSize int, a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -189,7 +189,7 @@ func (cw CondWrapper) TLPrint(maxSize int, a ...any) (int, error) {
// TLPrintf removes all content on the current line and prints the new message
// limited by the text size
func (cw CondWrapper) TLPrintf(maxSize int, f string, a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -199,7 +199,7 @@ func (cw CondWrapper) TLPrintf(maxSize int, f string, a ...any) (int, error) {
// TPrintln removes all content on the current line and prints the new message
// limited by the text size with a new line symbol at the end
func (cw CondWrapper) TLPrintln(maxSize int, a ...any) (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -208,7 +208,7 @@ func (cw CondWrapper) TLPrintln(maxSize int, a ...any) (int, error) {

// NewLine prints a newline to standard output
func (cw CondWrapper) NewLine() (int, error) {
if cw.match == false {
if !cw.match {
return 0, nil
}

Expand All @@ -217,7 +217,7 @@ func (cw CondWrapper) NewLine() (int, error) {

// Bell prints alert (bell) symbol
func (cw CondWrapper) Bell() {
if cw.match == false {
if !cw.match {
return
}

Expand Down

0 comments on commit da798b6

Please sign in to comment.