G-Node / gin-cli

Command line client for GIN
https://gin.g-node.org
Other
12 stars 6 forks source link

LScmd enhancement #256

Closed hkchekc closed 5 years ago

hkchekc commented 5 years ago

As the title suggested. refer to issue #152 and #190

I make all Modification related status green, Untracked red (more or less as in git) and removed files yellow.

Synced and other status where there is no content changes remain white.

I personally think it looks good. Only thing I am not sure is that if we should use different color for remote and local changes

achilleas-k commented 5 years ago

Plain Printf() for colour doesn't work on Windows. You need to use Fprintf() with a colour writer. For instance, the general purpose colour writer in our progress print functions: https://github.com/G-Node/gin-cli/blob/5ee15738b8ce07663ffbeefc12854d5c82bcccd6/gincmd/common.go#L235

Not sure about the colour choices. I'd rather have synced files highlighted and untracked files not. I'd go for Green for Synced, Yellow for modified, Red for deleted, and White/uncoloured for untracked. This is different from what Git does, but Git uses Green for staged changes, which we consider some form of modified, but more importantly, the git status output doesn't show committed files which we do.

For the case switch where the colour is decided, the status variable is a FileStatus type. The Description() method is a convenience function for printing human readable text representing the status. It shouldn't be used to make any kind of programmatic decisions. For example, it could change at any time to make text clearer or the terms we use might change or it could be localised to different languages. FileStatus is an enum type and should be compared directly with the status constants (Synced, NoContent, etc) from the ginclient package.

hkchekc commented 5 years ago

Plain Printf() for colour doesn't work on Windows. You need to use Fprintf() with a colour writer. For instance, the general purpose colour writer in our progress print functions:

gin-cli/gincmd/common.go

Line 235 in 5ee1573 fmt.Fprint(color.Output, newprint)

Not sure about the colour choices. I'd rather have synced files highlighted and untracked files not. I'd go for Green for Synced, Yellow for modified, Red for deleted, and White/uncoloured for untracked. This is different from what Git does, but Git uses Green for staged changes, which we consider some form of modified, but more importantly, the git status output doesn't show committed files which we do.

For the case switch where the colour is decided, the status variable is a FileStatus type. The Description() method is a convenience function for printing human readable text representing the status. It shouldn't be used to make any kind of programmatic decisions. For example, it could change at any time to make text clearer or the terms we use might change or it could be localised to different languages. FileStatus is an enum type and should be compared directly with the status constants (Synced, NoContent, etc) from the ginclient package.

Color changes and Fprintf included

hkchekc commented 5 years ago

refer to also Issue #190. Add a few instructions to the gin ls output. The instructions suggest what can be the next step to deal with files under certain FileStatus

achilleas-k commented 5 years ago

Looks good. Thanks!