commit 66828105d090f28900ccf2703d05d112c4f33abb
parent 14d833400a367b05161b371ca1e1235faae065d0
Author: Byron Torres <b@torresjrjr.com>
Date: Sun, 7 Jan 2024 00:21:15 +0000
rename Command.cmdname to Command.name
Diffstat:
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/command.ha b/command.ha
@@ -13,7 +13,7 @@ use types;
type Command = struct{
addrs: []Address,
linenums: []size,
- cmdname: rune,
+ name: rune,
printmode: PrintMode,
arg1: str,
arg2: str,
@@ -298,15 +298,15 @@ fn cmd_global(s: *Session, cmd: *Command) (void | Error) = {
return e;
};
- debug("cmd_global() for subcmd.cmdname=<{}>", subcmd.cmdname);
+ debug("cmd_global() for subcmd.name=<{}>", subcmd.name);
// TODO: write new parse_global() function instead
// as to avoid reading multiple lines in the case of
// 'a', 'c', 'i' ?
- switch (subcmd.cmdname) {
+ switch (subcmd.name) {
case 'g', 'G', 'v', 'V', '!' =>
// TODO: implement?
- errormsg(s, subcmd.cmdname: InvalidGlobalSubCmd);
+ errormsg(s, subcmd.name: InvalidGlobalSubCmd);
continue;
case '&' =>
errormsg(s, '&': UnknownCommand);
@@ -324,7 +324,7 @@ fn cmd_global(s: *Session, cmd: *Command) (void | Error) = {
debug("cmd_global() len(subcmds)={}", len(subcmds));
if (len(subcmds) == 0)
- append(subcmds, Command{ cmdname = 'p', ... });
+ append(subcmds, Command{ name = 'p', ... });
for :marks (true) {
// find next global-marked line
@@ -408,9 +408,9 @@ fn cmd_global_interative(s: *Session, cmd: *Command) (void | Error) = {
// TODO: write new parse_global_interactive() function instead
// as to avoid reading multiple lines in the case of
// 'a', 'c', 'i' ?
- switch (subcmd.cmdname) {
+ switch (subcmd.name) {
case 'a', 'c', 'i', 'g', 'G', 'v', 'V' =>
- errormsg(s, subcmd.cmdname: InvalidGlobalSubCmd);
+ errormsg(s, subcmd.name: InvalidGlobalSubCmd);
continue;
case NUL =>
line.globalmark = false;
diff --git a/execute.ha b/execute.ha
@@ -8,7 +8,7 @@ fn execute(s: *Session, cmd: *Command) (void | Error) = {
return err;
};
- match (lookupcmd(cmd.cmdname)(s, cmd)) {
+ match (lookupcmd(cmd.name)(s, cmd)) {
case void => void;
case let err: Error =>
errormsg(s, err);
diff --git a/main.ha b/main.ha
@@ -93,14 +93,14 @@ export fn main() void = {
case let cmd: Command =>
yield cmd;
case io::EOF =>
- yield Command{ cmdname = 'q', ... };
+ yield Command{ name = 'q', ... };
case let err: ParseError =>
errormsg(&s, strerror(err));
continue;
};
defer command_finish(&cmd);
- if (cmd.cmdname == '&') {
+ if (cmd.name == '&') {
errormsg(&s, '&': UnknownCommand);
continue;
};
diff --git a/parse.ha b/parse.ha
@@ -49,10 +49,10 @@ fn parse(input: *bufio::scanner) (Command | ParseError | InteractionError) = {
let cmd = Command{ ... };
cmd.addrs = scan_addrs(&iter);
- cmd.cmdname = scan_cmdname(&iter)?;
+ cmd.name = scan_cmdname(&iter)?;
parse_cmdargs(&cmd, &iter)?;
- switch :input (cmd.cmdname) {
+ switch :input (cmd.name) {
case => void;
case 'a', 'c', 'i' =>
for (true) {
@@ -106,7 +106,7 @@ fn parse(input: *bufio::scanner) (Command | ParseError | InteractionError) = {
// TODO: remove 'bool' returns
fn parse_cmdargs(cmd: *Command, iter: *strings::iterator) (bool | ParseError) = {
- switch (cmd.cmdname) {
+ switch (cmd.name) {
// [ ]
case NUL =>
return true;