-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e980428
commit a7287e0
Showing
7 changed files
with
53 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package commands | ||
|
||
import ( | ||
"os/exec" | ||
|
||
"github.com/fatih/color" | ||
"github.com/jesseduffield/gocui" | ||
"github.com/jesseduffield/lazynpm/pkg/utils" | ||
) | ||
|
||
type CommandView struct { | ||
// not super keen on having this dependency on gocui here but alas | ||
View *gocui.View | ||
Cmd *exec.Cmd | ||
} | ||
|
||
func (cv *CommandView) Status() string { | ||
if cv == nil { | ||
return "" | ||
} | ||
|
||
if cv.Cmd.ProcessState == nil { | ||
return utils.ColoredString(utils.Loader(), color.FgCyan) | ||
} else { | ||
if cv.Cmd.ProcessState.Success() { | ||
return utils.ColoredString("!", color.FgGreen) | ||
} else { | ||
return utils.ColoredString("X", color.FgRed) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters