Skip to content

Commit

Permalink
Changed the 'log_enum' example to 'logger'
Browse files Browse the repository at this point in the history
- Changed the 'log_enum' example filename to 'logger'.
- Changed the internal Command.
- Recreated the example Meta Docs.
- Deleted old 'log_enum' artifacts.
  • Loading branch information
00JCIV00 committed Oct 23, 2024
1 parent 1b8067e commit 9aee63d
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 38 deletions.
6 changes: 3 additions & 3 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn build(b: *std.Build) void {
//==========================================
// Examples
//==========================================
const examples = &.{ "cova-demo", "basic-app", "log-enum" };
const examples = &.{ "cova-demo", "basic-app", "logger" };
var ex_arena = std.heap.ArenaAllocator.init(b.allocator);
defer ex_arena.deinit();
const ex_alloc = ex_arena.allocator();
Expand Down Expand Up @@ -82,8 +82,8 @@ pub fn build(b: *std.Build) void {
ex_exe,
.{
.kinds = &.{ .all },
.version = "0.10.1",
.ver_date = "27 AUG 2024",
.version = "0.10.2",
.ver_date = "23 OCT 2024",
.author = "00JCIV00",
.copyright = "MIT License",
.help_docs_config = .{
Expand Down
2 changes: 1 addition & 1 deletion examples/log-enum.zig → examples/logger.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub const CommandT = cova.Command.Custom(.{
},
});
pub const setup_cmd = CommandT{
.name = "log_enum",
.name = "logger",
.description = "A small demo of using the Log Level Enum as an Option.",
.opts = &.{
.{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"Meta Info": {
"name": "log_enum",
"name": "logger",
"description": "A small demo of using the Log Level Enum as an Option.",
"version": "0.10.1",
"ver_date": "27 AUG 2024",
"version": "0.10.2",
"ver_date": "23 OCT 2024",
"author": "00JCIV00",
"copyright": "MIT License"
},
"Arguments": {
"name": "log_enum",
"name": "logger",
"description": "A small demo of using the Log Level Enum as an Option.",
"opts": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# This KDL template is formatted to match the `usage` tool as detailed here: https://sr.ht/~jdx/usage/

name "log_enum"
bin "log_enum"
name "logger"
bin "logger"
about "A small demo of using the Log Level Enum as an Option."
version "0.10.1"
version "0.10.2"
author "00JCIV00"

flag "--log-level" help="An Option using the `log.Level` Enum."
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.TH log_enum 1 "27 AUG 2024" "0.10.1"
.TH logger 1 "23 OCT 2024" "0.10.2"

.SH NAME
.B log_enum
.B logger

.SH SYNOPSIS
.B log_enum
.B logger
.RB [OPTIONS]

.SH DESCRIPTION
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# log_enum
# logger
A small demo of using the Log Level Enum as an Option.

__Version:__ 0.10.1<br>
__Date:__ 27 AUG 2024<br>
__Version:__ 0.10.2<br>
__Date:__ 23 OCT 2024<br>
__Author:__ 00JCIV00<br>
__Copyright:__ MIT License<br>
___

## Usage
```shell
USAGE:
log_enum ​​--log-level <log.Level>
log_enum
logger ​​--log-level <log.Level>
logger

```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#compdef log_enum
#compdef logger

# This Tab Completion script was generated by the Cova Library.
# Details at https://github.com/00JCIV00/cova


# Zsh Completion Installation Instructions for log_enum
# Zsh Completion Installation Instructions for logger
# 1. Place this script in a directory specified in your $fpath, or a new one such as
# ~/.zsh/completion/
#
# 2. Ensure the script has executable permissions:
# chmod +x _log_enum-completion.zsh
# chmod +x _logger-completion.zsh
#
# 3. Add the script's directory to your $fpath in your .zshrc if not already included:
# fpath=(~/.zsh/completion $fpath)
Expand All @@ -24,13 +24,13 @@
# Associative array to hold Commands, Options, and their descriptions with arbitrary depth
typeset -A cmd_args
cmd_args=(
"log_enum" "help usage --log-level --help --usage"
"logger" "help usage --log-level --help --usage"
)
# Generic function for command completions
_log_enum_completions() {
_logger_completions() {
local -a completions
# Determine the current command context
local context="log_enum"
local context="logger"
for word in "${words[@]:1:$CURRENT-1}"; do
if [[ -n $cmd_args[${context}_${word}] ]]; then
context="${context}_${word}"
Expand All @@ -39,7 +39,7 @@ _log_enum_completions() {
# Generate completions for the current context
completions=(${(s: :)cmd_args[$context]})
if [[ -n $completions ]]; then
_describe -t commands "log_enum" completions && return 0
_describe -t commands "logger" completions && return 0
fi
}
_log_enum_completions "$@"
_logger_completions "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@
# Details at https://github.com/00JCIV00/cova


# Bash Completion Installation Instructions for log_enum
# Bash Completion Installation Instructions for logger
# 1. Place this script in a directory like /etc/bash_completion.d/ (Linux)
# or /usr/local/etc/bash_completion.d/ (Mac, if using Homebrew and bash-completion)
#
# 2. Ensure the script has executable permissions:
# chmod +x log_enum-completion.bash
# chmod +x logger-completion.bash
#
# 3. Source this script from your .bashrc or .bash_profile by adding:
# . /path/to/log_enum-completion.bash
# . /path/to/logger-completion.bash
#
# 4. Restart your terminal session or source your profile again:
# source ~/.bashrc # or ~/.bash_profile


_log_enum_completions() {
_logger_completions() {
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD - 1]}"

case "${prev}" in
"log_enum")
"logger")
COMPREPLY=($(compgen -W "help usage --log-level --help --usage" -- ${cur}))
;;
*)
Expand All @@ -34,4 +34,4 @@ _log_enum_completions() {
}


complete -F _log_enum_completions log_enum
complete -F _logger_completions logger
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
# Details at https://github.com/00JCIV00/cova


# PowerShell Completion Installation Instructions for log_enum
# PowerShell Completion Installation Instructions for logger
# 1. Load the completion script into your current PowerShell session:
# . .\log_enum-completion.ps1
# . .\logger-completion.ps1
#
# 2. Ensure your Execution Policy allows the script to be run. Example:
# Set-ExecutionPolicy RemoteSigned
#
# 3. To ensure this completion script is loaded automatically in future sessions,
# add the above sourcing command to your PowerShell profile:
# Notepad $PROFILE
# Add the line: . C:\path\to\log_enum-completion.ps1
# Add the line: . C:\path\to\logger-completion.ps1
#
# 4. Restart your PowerShell session or source your profile again:
# . $PROFILE


function _log_enum {
function _logger {
param($wordToComplete, $commandAst)
$suggestions = @(
'help',
Expand All @@ -32,7 +32,7 @@ function _log_enum {
return $suggestions | Where-Object { $_ -like "$wordToComplete*" }
}

Register-ArgumentCompleter -CommandName 'log_enum.exe' -ScriptBlock {
Register-ArgumentCompleter -CommandName 'logger.exe' -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPos)

$functionName = "_" + $($commandAst.Extent.Text.replace(' ', '-').replace(".exe", ""))
Expand Down

0 comments on commit 9aee63d

Please sign in to comment.