Skip to content

Commit

Permalink
stat and geometry commands, refine analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
dfgordon committed Dec 31, 2023
1 parent 364d874 commit 37108e7
Show file tree
Hide file tree
Showing 33 changed files with 889 additions and 57 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "a2kit"
version = "2.6.1"
version = "2.7.0"
edition = "2021"
readme = "README.md"
license = "MIT"
Expand Down
48 changes: 48 additions & 0 deletions completions/_a2kit
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,22 @@ _arguments "${_arguments_options[@]}" \
'--help[Print help]' \
&& ret=0
;;
(stat)
_arguments "${_arguments_options[@]}" \
'-d+[path to disk image]:PATH:_files' \
'--dimg+[path to disk image]:PATH:_files' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(geometry)
_arguments "${_arguments_options[@]}" \
'-d+[path to disk image]:PATH:_files' \
'--dimg+[path to disk image]:PATH:_files' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(tokenize)
_arguments "${_arguments_options[@]}" \
'-a+[address of tokenized code (Applesoft only)]:ADDRESS: ' \
Expand Down Expand Up @@ -403,6 +419,14 @@ _arguments "${_arguments_options[@]}" \
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(stat)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(geometry)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(tokenize)
_arguments "${_arguments_options[@]}" \
&& ret=0
Expand Down Expand Up @@ -456,6 +480,8 @@ _a2kit_commands() {
'dir:write disk image catalog to stdout' \
'ls:write disk image catalog to stdout' \
'tree:write directory tree as a JSON string to stdout' \
'stat:write FS statistics as a JSON string to stdout' \
'geometry:write disk geometry as a JSON string to stdout' \
'tokenize:read from stdin, tokenize, write to stdout' \
'tok:read from stdin, tokenize, write to stdout' \
'detokenize:read from stdin, detokenize, write to stdout' \
Expand Down Expand Up @@ -494,6 +520,16 @@ _a2kit__help__detokenize_commands() {
local commands; commands=()
_describe -t commands 'a2kit help detokenize commands' commands "$@"
}
(( $+functions[_a2kit__geometry_commands] )) ||
_a2kit__geometry_commands() {
local commands; commands=()
_describe -t commands 'a2kit geometry commands' commands "$@"
}
(( $+functions[_a2kit__help__geometry_commands] )) ||
_a2kit__help__geometry_commands() {
local commands; commands=()
_describe -t commands 'a2kit help geometry commands' commands "$@"
}
(( $+functions[_a2kit__get_commands] )) ||
_a2kit__get_commands() {
local commands; commands=()
Expand Down Expand Up @@ -523,6 +559,8 @@ _a2kit__help_commands() {
'put:read from stdin, write to local or disk image' \
'catalog:write disk image catalog to stdout' \
'tree:write directory tree as a JSON string to stdout' \
'stat:write FS statistics as a JSON string to stdout' \
'geometry:write disk geometry as a JSON string to stdout' \
'tokenize:read from stdin, tokenize, write to stdout' \
'detokenize:read from stdin, detokenize, write to stdout' \
'help:Print this message or the help of the given subcommand(s)' \
Expand Down Expand Up @@ -624,6 +662,16 @@ _a2kit__retype_commands() {
local commands; commands=()
_describe -t commands 'a2kit retype commands' commands "$@"
}
(( $+functions[_a2kit__help__stat_commands] )) ||
_a2kit__help__stat_commands() {
local commands; commands=()
_describe -t commands 'a2kit help stat commands' commands "$@"
}
(( $+functions[_a2kit__stat_commands] )) ||
_a2kit__stat_commands() {
local commands; commands=()
_describe -t commands 'a2kit stat commands' commands "$@"
}
(( $+functions[_a2kit__help__tokenize_commands] )) ||
_a2kit__help__tokenize_commands() {
local commands; commands=()
Expand Down
24 changes: 24 additions & 0 deletions completions/_a2kit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Register-ArgumentCompleter -Native -CommandName 'a2kit' -ScriptBlock {
[CompletionResult]::new('put', 'put', [CompletionResultType]::ParameterValue, 'read from stdin, write to local or disk image')
[CompletionResult]::new('catalog', 'catalog', [CompletionResultType]::ParameterValue, 'write disk image catalog to stdout')
[CompletionResult]::new('tree', 'tree', [CompletionResultType]::ParameterValue, 'write directory tree as a JSON string to stdout')
[CompletionResult]::new('stat', 'stat', [CompletionResultType]::ParameterValue, 'write FS statistics as a JSON string to stdout')
[CompletionResult]::new('geometry', 'geometry', [CompletionResultType]::ParameterValue, 'write disk geometry as a JSON string to stdout')
[CompletionResult]::new('tokenize', 'tokenize', [CompletionResultType]::ParameterValue, 'read from stdin, tokenize, write to stdout')
[CompletionResult]::new('detokenize', 'detokenize', [CompletionResultType]::ParameterValue, 'read from stdin, detokenize, write to stdout')
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
Expand Down Expand Up @@ -223,6 +225,20 @@ Register-ArgumentCompleter -Native -CommandName 'a2kit' -ScriptBlock {
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
break
}
'a2kit;stat' {
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'path to disk image')
[CompletionResult]::new('--dimg', 'dimg', [CompletionResultType]::ParameterName, 'path to disk image')
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
break
}
'a2kit;geometry' {
[CompletionResult]::new('-d', 'd', [CompletionResultType]::ParameterName, 'path to disk image')
[CompletionResult]::new('--dimg', 'dimg', [CompletionResultType]::ParameterName, 'path to disk image')
[CompletionResult]::new('-h', 'h', [CompletionResultType]::ParameterName, 'Print help')
[CompletionResult]::new('--help', 'help', [CompletionResultType]::ParameterName, 'Print help')
break
}
'a2kit;tokenize' {
[CompletionResult]::new('-a', 'a', [CompletionResultType]::ParameterName, 'address of tokenized code (Applesoft only)')
[CompletionResult]::new('--addr', 'addr', [CompletionResultType]::ParameterName, 'address of tokenized code (Applesoft only)')
Expand Down Expand Up @@ -256,6 +272,8 @@ Register-ArgumentCompleter -Native -CommandName 'a2kit' -ScriptBlock {
[CompletionResult]::new('put', 'put', [CompletionResultType]::ParameterValue, 'read from stdin, write to local or disk image')
[CompletionResult]::new('catalog', 'catalog', [CompletionResultType]::ParameterValue, 'write disk image catalog to stdout')
[CompletionResult]::new('tree', 'tree', [CompletionResultType]::ParameterValue, 'write directory tree as a JSON string to stdout')
[CompletionResult]::new('stat', 'stat', [CompletionResultType]::ParameterValue, 'write FS statistics as a JSON string to stdout')
[CompletionResult]::new('geometry', 'geometry', [CompletionResultType]::ParameterValue, 'write disk geometry as a JSON string to stdout')
[CompletionResult]::new('tokenize', 'tokenize', [CompletionResultType]::ParameterValue, 'read from stdin, tokenize, write to stdout')
[CompletionResult]::new('detokenize', 'detokenize', [CompletionResultType]::ParameterValue, 'read from stdin, detokenize, write to stdout')
[CompletionResult]::new('help', 'help', [CompletionResultType]::ParameterValue, 'Print this message or the help of the given subcommand(s)')
Expand Down Expand Up @@ -309,6 +327,12 @@ Register-ArgumentCompleter -Native -CommandName 'a2kit' -ScriptBlock {
'a2kit;help;tree' {
break
}
'a2kit;help;stat' {
break
}
'a2kit;help;geometry' {
break
}
'a2kit;help;tokenize' {
break
}
Expand Down
88 changes: 86 additions & 2 deletions completions/a2kit.bash
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ _a2kit() {
a2kit,era)
cmd="a2kit__delete"
;;
a2kit,geometry)
cmd="a2kit__geometry"
;;
a2kit,get)
cmd="a2kit__get"
;;
Expand Down Expand Up @@ -72,6 +75,9 @@ _a2kit() {
a2kit,retype)
cmd="a2kit__retype"
;;
a2kit,stat)
cmd="a2kit__stat"
;;
a2kit,tok)
cmd="a2kit__tokenize"
;;
Expand Down Expand Up @@ -99,6 +105,9 @@ _a2kit() {
a2kit__help,detokenize)
cmd="a2kit__help__detokenize"
;;
a2kit__help,geometry)
cmd="a2kit__help__geometry"
;;
a2kit__help,get)
cmd="a2kit__help__get"
;;
Expand Down Expand Up @@ -132,6 +141,9 @@ _a2kit() {
a2kit__help,retype)
cmd="a2kit__help__retype"
;;
a2kit__help,stat)
cmd="a2kit__help__stat"
;;
a2kit__help,tokenize)
cmd="a2kit__help__tokenize"
;;
Expand All @@ -154,7 +166,7 @@ _a2kit() {

case "${cmd}" in
a2kit)
opts="-h -V --help --version mkdsk mkdir delete protect unprotect lock unlock rename retype verify minify renumber get put catalog tree tokenize detokenize help"
opts="-h -V --help --version mkdsk mkdir delete protect unprotect lock unlock rename retype verify minify renumber get put catalog tree stat geometry tokenize detokenize help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -249,6 +261,28 @@ _a2kit() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
a2kit__geometry)
opts="-d -h --dimg --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--dimg)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-d)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
a2kit__get)
opts="-f -t -d -l -h --file --type --dimg --len --trunc --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand Down Expand Up @@ -296,7 +330,7 @@ _a2kit() {
return 0
;;
a2kit__help)
opts="mkdsk mkdir delete protect unprotect lock unlock rename retype verify minify renumber get put catalog tree tokenize detokenize help"
opts="mkdsk mkdir delete protect unprotect lock unlock rename retype verify minify renumber get put catalog tree stat geometry tokenize detokenize help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -351,6 +385,20 @@ _a2kit() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
a2kit__help__geometry)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
a2kit__help__get)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
Expand Down Expand Up @@ -505,6 +553,20 @@ _a2kit() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
a2kit__help__stat)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
a2kit__help__tokenize)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
Expand Down Expand Up @@ -949,6 +1011,28 @@ _a2kit() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
a2kit__stat)
opts="-d -h --dimg --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--dimg)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-d)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
a2kit__tokenize)
opts="-a -t -h --addr --type --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand Down
20 changes: 20 additions & 0 deletions completions/a2kit.elv
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ set edit:completion:arg-completer[a2kit] = {|@words|
cand put 'read from stdin, write to local or disk image'
cand catalog 'write disk image catalog to stdout'
cand tree 'write directory tree as a JSON string to stdout'
cand stat 'write FS statistics as a JSON string to stdout'
cand geometry 'write disk geometry as a JSON string to stdout'
cand tokenize 'read from stdin, tokenize, write to stdout'
cand detokenize 'read from stdin, detokenize, write to stdout'
cand help 'Print this message or the help of the given subcommand(s)'
Expand Down Expand Up @@ -203,6 +205,18 @@ set edit:completion:arg-completer[a2kit] = {|@words|
cand -h 'Print help'
cand --help 'Print help'
}
&'a2kit;stat'= {
cand -d 'path to disk image'
cand --dimg 'path to disk image'
cand -h 'Print help'
cand --help 'Print help'
}
&'a2kit;geometry'= {
cand -d 'path to disk image'
cand --dimg 'path to disk image'
cand -h 'Print help'
cand --help 'Print help'
}
&'a2kit;tokenize'= {
cand -a 'address of tokenized code (Applesoft only)'
cand --addr 'address of tokenized code (Applesoft only)'
Expand Down Expand Up @@ -234,6 +248,8 @@ set edit:completion:arg-completer[a2kit] = {|@words|
cand put 'read from stdin, write to local or disk image'
cand catalog 'write disk image catalog to stdout'
cand tree 'write directory tree as a JSON string to stdout'
cand stat 'write FS statistics as a JSON string to stdout'
cand geometry 'write disk geometry as a JSON string to stdout'
cand tokenize 'read from stdin, tokenize, write to stdout'
cand detokenize 'read from stdin, detokenize, write to stdout'
cand help 'Print this message or the help of the given subcommand(s)'
Expand Down Expand Up @@ -270,6 +286,10 @@ set edit:completion:arg-completer[a2kit] = {|@words|
}
&'a2kit;help;tree'= {
}
&'a2kit;help;stat'= {
}
&'a2kit;help;geometry'= {
}
&'a2kit;help;tokenize'= {
}
&'a2kit;help;detokenize'= {
Expand Down
Loading

0 comments on commit 37108e7

Please sign in to comment.