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

Subversion Repositories soc_maker

[/] [soc_maker/] [trunk/] [bin/] [soc_maker_cli] - Blame information for rev 10

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 feddischso
#!/usr/bin/env ruby
2
 
3
root = File.expand_path('../..', __FILE__)
4
require File.join(root, %w[lib soc_maker])
5
require 'ostruct'
6
 
7
 
8
cmd_options = OpenStruct.new
9
cmd_options.lib_inc = []
10
cmd_options.log_out = "socmaker_log.txt"
11
 
12
##
13
# create option-parser and manage
14
# options
15
#
16
OptionParser.new do |opts|
17
 
18
  opts.banner = "Usage: soc_maker_cli [ options ]"
19
 
20
  opts.on("-h", "--help", "Show this message") do
21
    puts opts
22
    exit
23
  end
24
 
25 5 feddischso
  opts.on("-l", "--library ", Array,
26
        "Sets library include paths (overrides config value)" ) do |path|
27 3 feddischso
    cmd_options.lib_inc << path
28
  end
29
 
30
  opts.on("-o", "--log-out ", String, "Sets the log output file" ) do |file|
31
    cmd_options.log_out = file
32
  end
33
 
34
  begin
35
    opts.parse!( ARGV )
36
  rescue OptionParser::ParseError => e
37
    STDERR.puts e.message, "\n", opts
38
    exit(-1)
39
  end
40
end
41
 
42
 
43
# manage stdout value
44
cmd_options.log_out = STDOUT if cmd_options.log_out.upcase == "STDOUT"
45
 
46
 
47
# setup options for loading the SOCMaker core
48
options = {}
49
options[ :libpath     ] = cmd_options.lib_inc.flatten if cmd_options.lib_inc.size > 0
50
options[ :logger_out  ] = cmd_options.log_out
51
 
52
##
53
# initialize SOCMaker core
54
#   this sets up logging and parses all yaml files
55
#   found in the configure path (see also soc_maker_conf.rb)
56
SOCMaker::load( options )
57
 
58
# Print license info
59
puts SOCMaker::conf[ :LIC ] + "\n\n"
60
 
61
 
62
 
63
cli = SOCMaker::Cli::instance
64
if ARGF.filename != '-'
65
  ARGF.each do |line|
66
    cli.process_cmd line
67
  end
68
end
69
cli.run
70
 
71
# vim: noai:ts=2:sw=2
72
 

powered by: WebSVN 2.1.0

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