source: trunk/plugins/admin_fact.tcl @ 1143

Revision 447, 1.5 KB checked in by jamesoff, 8 years ago (diff)

change to management plugin not admin

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1# bMotion: admin plugin file for facts
2#
3# $Id$
4#
5
6###############################################################################
7# This is a bMotion plugin
8# Copyright (C) James Michael Seward 2000-2002
9#
10# This program is covered by the GPL, please refer the to LICENCE file in the
11# distribution; further information can be found in the headers of the scripts
12# in the modules directory.
13###############################################################################
14
15proc bMotion_plugin_management_fact { handle { arg "" }} {
16
17  global bMotionFacts
18
19  #fact show <type> <name>
20  if [regexp -nocase {show ([^ ]+) ([^ ]+)} $arg matches t name] {
21    set known $bMotionFacts($t,$name)
22    bMotion_putadmin "Known '$t' facts about: $name"
23    set count 0
24    foreach fact $known {
25      bMotion_putadmin "$count: $fact"
26      incr count
27    }
28    return 0
29  }
30
31  #status
32  if [regexp -nocase {status} $arg] {
33    set items [lsort [array names bMotionFacts]]
34    set itemcount 0
35    set factcount 0
36    #bMotion_putadmin "Known facts:"
37    foreach item $items {
38      #bMotion_putadmin "$item ([llength $bMotionFacts($item)])"
39      incr itemcount
40      incr factcount [llength $bMotionFacts($item)]
41    }
42    bMotion_putadmin "Total: $factcount facts about $itemcount items"
43    return 0
44  }
45
46  #all else fails, list help
47  bMotion_putadmin {use: fact [show <type> <name>|status]}
48  return 0
49}
50
51# register the plugin
52bMotion_plugin_add_management "fact" "^fact" n "bMotion_plugin_management_fact" "any"
Note: See TracBrowser for help on using the repository browser.