|
|
|
|
@ -35,23 +35,39 @@ namespace eval punk::mix::commandset::loadedlib {
|
|
|
|
|
-highlight -type boolean -default 1 -help\ |
|
|
|
|
"Highlight which version is present with ansi underline and colour" |
|
|
|
|
-refresh -default 0 -type boolean -help "Re-scan the tm and library folders" |
|
|
|
|
searchstrings -default * -multiple 1 -help\ |
|
|
|
|
searchstring -default * -multiple 1 -help\ |
|
|
|
|
"Names to search for, may contain glob chars (* ?) e.g *lib* |
|
|
|
|
If no glob chars are explicitly specified, the searchstring will be wrapped with star globs. |
|
|
|
|
eg name -> *name* |
|
|
|
|
To search for an exact name prefix it with = |
|
|
|
|
e.g =name -> name |
|
|
|
|
" |
|
|
|
|
If search is not prefixed with '=' the search is case insensitive." |
|
|
|
|
} |
|
|
|
|
proc search {args} { |
|
|
|
|
set argd [punk::args::get_by_id ::punk::mix::commandset::loadedlib::search $args] |
|
|
|
|
set searchstrings [dict get $argd values searchstrings] |
|
|
|
|
set searchstrings [dict get $argd values searchstring] |
|
|
|
|
set opts [dict get $argd opts] |
|
|
|
|
set opt_return [dict get $opts -return] |
|
|
|
|
set opt_highlight [dict get $opts -highlight] |
|
|
|
|
set opt_refresh [dict get $opts -refresh] |
|
|
|
|
|
|
|
|
|
if {$opt_refresh} { |
|
|
|
|
catch {package require frobznodule666} ;#ensure pkg system has loaded/searched for everything REVIEW - this doesn't result in full scans |
|
|
|
|
foreach tm_path [tcl::tm::list] { |
|
|
|
|
set paths_below [punk::path::subfolders -recursive $tm_path] |
|
|
|
|
foreach folder $paths_below { |
|
|
|
|
set tail [file tail $folder] |
|
|
|
|
if {[string match #modpod-* $tail] || [string match #tarjar-* $tail]} { |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
if {[string match */_build/* $folder]} {continue} |
|
|
|
|
set relpath [string tolower [punk::path::relative $tm_path $folder]] |
|
|
|
|
set modpath [string map {/ ::} $relpath] |
|
|
|
|
catch {package require ${modpath}::flobrudder99} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#REVIEW - this doesn't result in full scans |
|
|
|
|
catch {package require frobznodule666} ;#ensure pkg system has loaded/searched for everything |
|
|
|
|
|
|
|
|
|
set packages [package names] |
|
|
|
|
set matches [list] |
|
|
|
|
@ -122,9 +138,25 @@ namespace eval punk::mix::commandset::loadedlib {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
proc loaded.search {searchstring} { |
|
|
|
|
set search_result [search $searchstring] |
|
|
|
|
set all_libs [split $search_result \n] |
|
|
|
|
|
|
|
|
|
punk::args::define { |
|
|
|
|
@id -id ::punk::mix::commandset::loadedlib::loaded.search |
|
|
|
|
@cmd -name "punk::mix::commandset::loadedlib loaded.search"\ |
|
|
|
|
-summary\ |
|
|
|
|
"Search loaded libraries."\ |
|
|
|
|
-help "search all Tcl libraries currently loaded in your local interpreter. |
|
|
|
|
ie those that have been loaded directly or indirectly by 'package require'." |
|
|
|
|
}\ |
|
|
|
|
@values\ |
|
|
|
|
[punk::args::resolved_def -types values ::punk::mix::commandset::loadedlib::search searchstring] |
|
|
|
|
|
|
|
|
|
proc loaded.search {args} { |
|
|
|
|
set argd [punk::args::parse $args withid ::punk::mix::commandset::loadedlib::loaded.search] |
|
|
|
|
lassign [dict values $argd] leaders opts values |
|
|
|
|
set searchstrings [dict get $values searchstring] |
|
|
|
|
|
|
|
|
|
set all_libs [search -return list -highlight 0 {*}$searchstrings] |
|
|
|
|
|
|
|
|
|
set col1items [list] |
|
|
|
|
set col2items [list] |
|
|
|
|
set col3items [list] |
|
|
|
|
|