David Young 2 years ago
parent 60e1a3bf68
commit 8654792c72

@ -81,6 +81,8 @@ def parse_query(args):
result['force-ansi'] = True
if 'n' in q:
result['narrow'] = True
if 'N' in q:
result['narrow-full'] = True
if 'm' in q:
result['use_metric'] = True
if 'M' in q:

@ -84,6 +84,9 @@ def _wego_wrapper(location, parsed_query):
if parsed_query.get('narrow'):
cmd += ['-narrow']
if parsed_query.get('narrow-full'):
cmd += ['-narrow-full']
if lang and lang in SUPPORTED_LANGS:
cmd += ['-lang=%s'%lang]

@ -29,6 +29,7 @@ type configuration struct {
Inverse bool
Lang string
Narrow bool
NarrowFull bool
LocationName string
WindMS bool
RightToLeft bool
@ -71,6 +72,7 @@ func init() {
flag.BoolVar(&config.Imperial, "imperial", false, "Use imperial units")
flag.BoolVar(&config.Inverse, "inverse", false, "Use inverted colors")
flag.BoolVar(&config.Narrow, "narrow", false, "Narrow output (two columns)")
flag.BoolVar(&config.NarrowFull, "narrow-full", false, "Narrow output w/ all dayparts (two columns, two rows)")
flag.StringVar(&config.LocationName, "location_name", "", "Location name (used in the caption)")
flag.BoolVar(&config.WindMS, "wind_in_ms", false, "Show wind speed in m/s")
flag.BoolVar(&config.RightToLeft, "right_to_left", false, "Right to left script")

@ -88,7 +88,23 @@ func printDay(w weather) (ret []string) {
if t, ok := daytimeTranslation[config.Lang]; ok {
trans = t
}
if config.Narrow {
if config.NarrowFull {
names_1 := "│ " + justifyCenter(trans[0], 16) +
"└──────┬──────┘" + justifyCenter(trans[1], 16) + " │"
names_2 := "│ " + justifyCenter(trans[2], 16) +
"└──────┬──────┘" + justifyCenter(trans[3], 16) + " │"
ret = append([]string{
" ┌─────────────┐ ",
"┌───────────────────────" + dateFmt + "───────────────────────┐",
names_1,
names_2,
"├──────────────────────────────┼──────────────────────────────┤"},
ret...)
return append(ret,
"└──────────────────────────────┴──────────────────────────────┘")
} else if config.Narrow {
names := "│ " + justifyCenter(trans[1], 16) +
"└──────┬──────┘" + justifyCenter(trans[3], 16) + " │"

Loading…
Cancel
Save