uppercase the command line symbol name

This commit is contained in:
Emil Lerch 2026-03-17 10:10:29 -07:00
parent b248461034
commit e5cb7d2b32
Signed by: lobo
GPG key ID: A7B62D657EF764F8
2 changed files with 9 additions and 5 deletions

View file

@ -27,9 +27,8 @@ question: fixed at 2, or arbitrary N?
## TUI issues ## TUI issues
Starting the TUI with a ticker symbol doesn't uppercase (why can't we just solve Display artifacts that don't go away when switching tabs (need specific steps
this once?). Display artifacts that don't go away when switching tabs (need to reproduce).
specific steps to reproduce).
## Risk-free rate maintenance ## 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 portfolio_path: ?[]const u8 = null;
var watchlist_path: ?[]const u8 = null; var watchlist_path: ?[]const u8 = null;
var symbol: []const u8 = ""; var symbol: []const u8 = "";
var symbol_upper_buf: [32]u8 = undefined;
var has_explicit_symbol = false; var has_explicit_symbol = false;
var skip_watchlist = false; var skip_watchlist = false;
var chart_config: chart_mod.ChartConfig = .{}; 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")) { } else if (std.mem.eql(u8, args[i], "--symbol") or std.mem.eql(u8, args[i], "-s")) {
if (i + 1 < args.len) { if (i + 1 < args.len) {
i += 1; 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; has_explicit_symbol = true;
skip_watchlist = 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] != '-') { } 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; has_explicit_symbol = true;
} }
} }