Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Narrow Full" format #850

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/parse_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions lib/view/wttr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
2 changes: 2 additions & 0 deletions share/we-lang/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type configuration struct {
Inverse bool
Lang string
Narrow bool
NarrowFull bool
LocationName string
WindMS bool
RightToLeft bool
Expand Down Expand Up @@ -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")
Expand Down
18 changes: 17 additions & 1 deletion share/we-lang/view1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) + " │"
Expand Down