OpenCores
URL https://opencores.org/ocsvn/soc_maker/soc_maker/trunk

Subversion Repositories soc_maker

[/] [soc_maker/] [trunk/] [lib/] [soc_maker/] [cli.rb] - Diff between revs 3 and 5

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 3 Rev 5
Line 283... Line 283...
      @soc.copy_files
      @soc.copy_files
    end
    end
  end
  end
 
 
 
 
 
 
 
  PRINT_USAGE =
 
  "  > print            # prints SOC information
 
 
 
  "
 
  def do_print( args )
 
    if args.size != 0
 
      puts "no arguments are required:\nusage:\n#{PRINT_USAGE}"
 
    else
 
      puts @soc
 
    end
 
  end
 
 
 
 
  #
  #
  # Quit
  # Quit
  #
  #
  QUIT_USAGE =
  QUIT_USAGE =
  "  > quit             # the same than exit
  "  > quit             # the same than exit
Line 320... Line 334...
  def do_help( args )
  def do_help( args )
    puts "The following commands are available:\n\n"
    puts "The following commands are available:\n\n"
    @commands.each { |c| eval "puts  #{c.upcase}_USAGE" }
    @commands.each { |c| eval "puts  #{c.upcase}_USAGE" }
  end
  end
 
 
 
 
 
  SET_USAGE =
 
  "  > set              # not implemented yet
 
 
 
  "
 
  def do_set( args )
 
    puts "NOT IMPLEMENTED, YET"
 
  end
 
 
 
  GET_USAGE =
 
  "  > get              # not implemented yet
 
 
 
  "
 
  def do_get( args )
 
    puts "NOT IMPLEMENTED, YET"
 
  end
 
 
  #  end command implementations
  #  end command implementations
  #
  #
  #################################
  #################################
 
 
 
 
 
 
  @soc = nil
  @soc = nil
 
 
  def initialize
  def initialize
    ##
 
    # Setup readline
 
    #
 
    @cmd_list = %w[ list generate open exit
 
                   help quit add parameter save
 
                   connect sparameter delete ].sort
 
 
 
    # appreviation map
    # appreviation map
    @appr_map = { 'n' => "new",
    @appr_map = { 'n' => "new",
                  'o' => "open",
                  'o' => "open",
                  'q' => "quit",
                  'q' => "quit",
Line 348... Line 373...
                  'g' => "generate",
                  'g' => "generate",
                  's' => "save",
                  's' => "save",
                  'p' => "parameter",
                  'p' => "parameter",
                  'd' => "delete",
                  'd' => "delete",
                  'c' => "connect",
                  'c' => "connect",
 
                  'i' => "print",
                  'x' => "exit"
                  'x' => "exit"
                  }
                  }
 
 
    # all available commands
    # all available commands
    @commands = %w[ new open list add parameter sparameter
    @commands = %w[ new open list add parameter sparameter
                    delete connect save help quit exit
                    delete connect save help quit exit
                    generate ]
                    generate print set get ]
 
 
    comp = proc { |s| (@cmd_list + Dir.entries( Dir.pwd )).grep( /^#{Regexp.escape(s)}/ ) }
    comp = proc { |s| (@commands + Dir.entries( Dir.pwd )).grep( /^#{Regexp.escape(s)}/ ) }
    Readline.completion_append_character = " "
    Readline.completion_append_character = " "
    Readline.completion_proc = comp
    Readline.completion_proc = comp
 
 
  end
  end
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.