Skip to content

Commit

Permalink
fix isDir checking condition & update zsh completion to list presets …
Browse files Browse the repository at this point in the history
…correctly
  • Loading branch information
AtifChy committed Aug 26, 2024
1 parent e35aed7 commit 14586eb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
20 changes: 10 additions & 10 deletions completions/fastfetch.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def main():
continue
if "short" in flag:
command_prefix = f"""-{flag["short"]}[{flag["desc"]}]"""
command_prefix = f"-{flag["short"]}[{flag["desc"]}]"
print_command(command_prefix, flag)
if "long" in flag:
command_prefix = f"""--{flag["long"]}[{flag["desc"]}]"""
command_prefix = f"--{flag["long"]}[{flag["desc"]}]"
print_command(command_prefix, flag)
Expand All @@ -40,16 +40,16 @@ def print_command(command_prefix: str, flag: dict):
elif type == "command":
print(f"{command_prefix}:module:->modules")
elif type == "config":
print(f"{command_prefix}:presets:->presets")
print(f"{command_prefix}:preset:->presets")
elif type == "enum":
temp: str = " ".join(flag["arg"]["enum"])
print(f'{command_prefix}:type:( {temp} )')
elif type == "logo":
print(f"{command_prefix}:logo:->logo")
print(f"{command_prefix}:logo:->logos")
elif type == "structure":
print(f"{command_prefix}:structure:->structure")
print(f"{command_prefix}:structure:->structures")
elif type == "path":
print(f"{command_prefix}:path:_files -/")
print(f"{command_prefix}:path:_files")
else:
print(f"{command_prefix}:")
else:
Expand All @@ -64,7 +64,7 @@ if __name__ == "__main__":
EOF
)"})

_arguments -C "$opts[@]"
_arguments "$opts[@]"

case $state in
modules)
Expand All @@ -74,16 +74,16 @@ EOF
;;
presets)
local -a presets=(
${$(fastfetch --list-presets autocompletion):#.*}
$(fastfetch --list-presets autocompletion)
"none:Disable loading config file"
)
_describe 'preset' presets
;;
structure)
structures)
local -a structures=( ${(f)"$(fastfetch --list-modules autocompletion)"} )
_describe 'structure' structures
;;
logo)
logos)
local -a logos=(
$(fastfetch --list-logos autocompletion)
"none:Don't print logo"
Expand Down
13 changes: 5 additions & 8 deletions src/common/io/io_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,12 @@ void listFilesRecursively(uint32_t baseLength, FFstrbuf* folder, uint8_t indenta
#ifdef _DIRENT_HAVE_D_TYPE
if(entry->d_type != DT_UNKNOWN && entry->d_type != DT_LNK)
isDir = entry->d_type == DT_DIR;
else
#else
{
struct stat stbuf;
if (fstatat(dfd, entry->d_name, &stbuf, 0) < 0)
isDir = false;
else
isDir = S_ISDIR(stbuf.st_mode);
}
struct stat stbuf;
if (fstatat(dfd, entry->d_name, &stbuf, 0) < 0)
isDir = false;
else
isDir = S_ISDIR(stbuf.st_mode);
#endif
if (isDir)
{
Expand Down

0 comments on commit 14586eb

Please sign in to comment.