Red background behind over quota - #114
Conversation
|
Mmm, what does it look like with dark terminal ? with bright terminal ? white ? dark ? |
|
I find it difficult to read on my terminal (dark colour scheme). The issue is that Another issue is that you can reach your quota without an entry turning red because a large file write will be rejected if you are close to your quota. (I tested this on Rorqual.) This can be fixed by using |
|
I wonder if we should also support some sort of non-colorized indications (for colourblind people). Maybe a |
|
I will try something. The |
|
Agreed. With |
|
Code updated to disable the color on demand, while having asterisks in any case. |
ofisette
left a comment
There was a problem hiding this comment.
Looks good to me! Works fine on Rorqual. Minor suggested changes.
|
This would be taken care of by adding
|
| parser.add_argument("--nearline", default=False, action='store_true', help="Display information for the nearline filesystem") | ||
| parser.add_argument("--per_user", default=False, action='store_true', help="Display per-user breakdown if available") | ||
| parser.add_argument("--all_users", default=False, action='store_true', help="Display information for all users of the project") | ||
| parser.add_argument('--color', default=True, action=argparse.BooleanOptionalAction, help="Display any usage over quota in red") |
There was a problem hiding this comment.
Suggestion:
import os +
parser.add_argument("--color", default = os.isatty(1) and not os.getenv("NO_COLOR",""),
action = argparse.BooleanOptionalAction,
help = "Display any over-quota usage in red")There was a problem hiding this comment.
I suggest to use default=None and pass the value to colorama.init(strip=args.color). This lets Colorama handle TTY detection, NO_COLOR (when implemented), and other checks as needed. Then, there is no need to conditionally define styles.
It is better for such things to be handled in the library and not duplicated in library-using programs.
There was a problem hiding this comment.
colorama.init(strip=args.color)
That should be colorama.init(strip=None if args.color is None else not args.color). Damn logic reversal…




When users have a long list of project and nearline spaces, and because the units are sometimes different between the usage and the quota, it is a bit hard to identify any over quota situations. With this change, the background color clearly identifies which quota has been reached or surpassed.