@@ -9,13 +9,16 @@ import (
99 "go.evanpurkhiser.com/dots/installer"
1010)
1111
12+ var e = color .RedString ("errs:" )
13+ var w = color .YellowString ("warn:" )
14+ var n = color .CyanString ("note:" )
15+
1216// Config is a object used to configure the output logger.
1317type Config struct {
1418 SourceConfig config.SourceConfig
1519 InstallConfig installer.InstallConfig
1620 PreparedInstall installer.PreparedInstall
1721 IsVerbose bool
18- IsInfo bool
1922}
2023
2124// New creates a output logger given a configuration.
@@ -84,7 +87,7 @@ func (l *Output) InstallInfo() {
8487// output anything without IsInfo. When IsVerbose is enabled additional
8588// information about the prepared dotfile will be included.
8689func (l * Output ) DotfileInfo (dotfile * installer.PreparedDotfile ) {
87- if ! l .IsInfo {
90+ if ! l .IsVerbose {
8891 return
8992 }
9093
@@ -130,21 +133,48 @@ func (l *Output) DotfileInfo(dotfile *installer.PreparedDotfile) {
130133 color .HiBlackString ("]" ),
131134 )
132135
133- output := fmt .Sprintf (" %%s %%-%ds %%s\n " , l .maxDotfileLength + 1 )
136+ output := fmt .Sprintf (" %%s %%-%ds %%s" , l .maxDotfileLength + 1 )
134137 fmt .Printf (
135138 output ,
136139 indicatorColor .Sprint (indicator ),
137140 dotfile .Path ,
138141 group ,
139142 )
140143
144+ if dotfile .Permissions .IsChanged () {
145+ fmt .Printf (
146+ " [%s %s %s]" ,
147+ color .New (color .FgHiRed ).Sprintf ("%#o" , int (dotfile .Permissions .Old )),
148+ color .HiWhiteString ("→" ),
149+ color .New (color .FgHiGreen ).Sprintf ("%#o" , int (dotfile .Permissions .New )),
150+ )
151+ }
152+
153+ ln (n , dotfile .Mode .Old .String ())
154+
155+ ln := func (v ... interface {}) {
156+ fmt .Printf (" %s %s\n " , v ... )
157+ }
158+
159+ fmt .Println ()
160+
141161 if dotfile .PrepareError != nil {
142- fmt . Printf ( " %s" , color .RedString (dotfile .PrepareError .Error ()))
162+ ln ( e , color .HiRedString (dotfile .PrepareError .Error ()))
143163 }
144164
145- if ! l .IsVerbose {
146- return
165+ if dotfile .SourcesAreIrregular {
166+ ln (e , "source files are irregular" )
167+ }
168+
169+ if dotfile .OverwritesExisting {
170+ ln (w , "ovewriting existing file" )
171+ }
172+
173+ if dotfile .SourcePermissionsDiffer {
174+ ln (w , "inconsistent source file permissions" )
147175 }
148176
149- // TODO: Implement all verbosity outputs here
177+ if dotfile .RemovedNull {
178+ ln (n , "nothing to remove" )
179+ }
150180}
0 commit comments