uppercase the command line symbol name

This commit is contained in:
Emil Lerch 2026-03-17 10:10:29 -07:00
parent d801fa0fe4
commit f6fb2a67a5
2 changed files with 9 additions and 5 deletions

View file

@ -27,9 +27,8 @@ question: fixed at 2, or arbitrary N?
## TUI issues
Starting the TUI with a ticker symbol doesn't uppercase (why can't we just solve
this once?). Display artifacts that don't go away when switching tabs (need
specific steps to reproduce).
Display artifacts that don't go away when switching tabs (need specific steps
to reproduce).
## Risk-free rate maintenance

View file

@ -3630,6 +3630,7 @@ pub fn run(allocator: std.mem.Allocator, config: zfin.Config, args: []const []co
var portfolio_path: ?[]const u8 = null;
var watchlist_path: ?[]const u8 = null;
var symbol: []const u8 = "";
var symbol_upper_buf: [32]u8 = undefined;
var has_explicit_symbol = false;
var skip_watchlist = false;
var chart_config: chart_mod.ChartConfig = .{};
@ -3656,7 +3657,9 @@ pub fn run(allocator: std.mem.Allocator, config: zfin.Config, args: []const []co
} else if (std.mem.eql(u8, args[i], "--symbol") or std.mem.eql(u8, args[i], "-s")) {
if (i + 1 < args.len) {
i += 1;
symbol = args[i];
const len = @min(args[i].len, symbol_upper_buf.len);
_ = std.ascii.upperString(symbol_upper_buf[0..len], args[i][0..len]);
symbol = symbol_upper_buf[0..len];
has_explicit_symbol = true;
skip_watchlist = true;
}
@ -3668,7 +3671,9 @@ pub fn run(allocator: std.mem.Allocator, config: zfin.Config, args: []const []co
}
}
} else if (args[i].len > 0 and args[i][0] != '-') {
symbol = args[i];
const len = @min(args[i].len, symbol_upper_buf.len);
_ = std.ascii.upperString(symbol_upper_buf[0..len], args[i][0..len]);
symbol = symbol_upper_buf[0..len];
has_explicit_symbol = true;
}
}