additions to the user guide, fix data store to not import globally defined values, added ability to flush datastores

git-svn-id: file:///home/svn/framework3/trunk@4387 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2007-02-15 08:02:47 +00:00
parent 38a454c410
commit 93da259db2
6 changed files with 234 additions and 637 deletions

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,10 @@ class DataStore < Hash
#
def import_options(options, imported_by = nil, overwrite = false)
options.each_option { |name, opt|
# If there's already a value defined for this option, then skip it
# and don't import it.
next if self[name]
# If the option has a default value, import it, but only if the
# datastore doesn't already have a value set for it.
if (opt.default and (overwrite or self[name] == nil))

View File

@ -937,11 +937,19 @@ class Core
if (args.length == 0)
print(
"Usage: unset var1 var2 var3 ...\n\n" +
"The unset command is used to unset one or more variables.\n")
"The unset command is used to unset one or more variables.\n" +
"To flush all entires, specify 'all' as the variable name")
return false
end
# If all was specified, then flush all of the entries
if args[0] == 'all'
print_line("Flushing datastore...")
datastore.clear
return true
end
while ((val = args.shift))
if (driver.on_variable_unset(global, val) == false)
print_error("The variable #{val} cannot be unset at this time.")

View File

@ -55,14 +55,6 @@ class Input::Buffer < Rex::Ui::Text::Input
return line
end
#
# Print a prompt and flush to the socket.
#
def _print_prompt(prompt)
@sock.rsock.write(prompt)
@sock.rsock.flush
end
#
# Returns whether or not EOF has been reached on stdin.
#

View File

@ -71,14 +71,6 @@ class Input::Socket < Rex::Ui::Text::Input
return line
end
#
# Print a prompt and flush to the socket.
#
def _print_prompt(prompt)
@sock.write(prompt)
@sock.flush
end
#
# Returns whether or not EOF has been reached on stdin.
#

View File

@ -25,14 +25,6 @@ class Input::Stdio < Rex::Ui::Text::Input
return $stdin.gets
end
#
# Print a prompt and flush standard output.
#
def _print_prompt(prompt)
$stdout.print(prompt)
$stdout.flush
end
#
# Returns whether or not EOF has been reached on stdin.
#