Skip to content

Commit

Permalink
chore: fixed some issues reported by nimalyzer
Browse files Browse the repository at this point in the history
FossilOrigin-Name: cec0085f945d542a67bd325360b79799222e18d211a381b77c1d568f8e93cc2d
  • Loading branch information
thindil committed Oct 15, 2024
1 parent 1697e2a commit 9bdd86c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/aliases.nim
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ const
'e': "standard error", 'f': "file", 'q': "quit"}.toTable
## The list of available options when setting the output of an alias

{.push ruleOff: "objects".}
using
db: DbConn # Connection to the shell's database
aliases: ref AliasesList # The list of aliases available in the selected directory
arguments: UserInput # The string with arguments entered by the user for the command
{.pop ruleOn: "objects".}

proc setAliases*(aliases; directory: Path; db) {.sideEffect, raises: [
], tags: [ReadDbEffect, WriteIOEffect, ReadEnvEffect, TimeEffect,
Expand Down Expand Up @@ -77,7 +79,7 @@ proc setAliases*(aliases; directory: Path; db) {.sideEffect, raises: [
# Set the aliases
type LocalAlias = ref object
id: Positive = 1
name: string
name: AliasName
var dbAliases: seq[LocalAlias] = @[LocalAlias()]
try:
db.rawSelect(qry = dbQuery, objs = dbAliases)
Expand Down Expand Up @@ -112,8 +114,8 @@ proc listAliases(arguments; aliases; db): ResultCode {.sideEffect, raises: [],
e = getCurrentException(), db = db)
type LocalAlias = ref object
id: Positive = 1
name: string
description: string
name: AliasName
description: AliasDescription
var dbAliases: seq[LocalAlias] = @[LocalAlias()]
# Show all available aliases declared in the shell
if arguments == "list all":
Expand Down Expand Up @@ -632,8 +634,8 @@ proc execAlias*(arguments; aliasId: UserInput; aliases;
return showError(message = "Can't get current directory. Reason: ",
e = getCurrentException(), db = db)
type LocalAlias = ref object
output: string
commands: string
output: AliasOutput
commands: AliasCommands
var alias: LocalAlias = LocalAlias()
try:
db.rawSelect(qry = "SELECT output, commands FROM aliases WHERE id=?",
Expand Down

0 comments on commit 9bdd86c

Please sign in to comment.