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 3

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
  opts.on("-l", "--library ", Array, "Sets library include paths (overrides config value)" ) do |path|
26
    cmd_options.lib_inc << path
27
  end
28
 
29
  opts.on("-o", "--log-out ", String, "Sets the log output file" ) do |file|
30
    cmd_options.log_out = file
31
  end
32
 
33
  begin
34
    opts.parse!( ARGV )
35
  rescue OptionParser::ParseError => e
36
    STDERR.puts e.message, "\n", opts
37
    exit(-1)
38
  end
39
end
40
 
41
 
42
# manage stdout value
43
cmd_options.log_out = STDOUT if cmd_options.log_out.upcase == "STDOUT"
44
 
45
 
46
# setup options for loading the SOCMaker core
47
options = {}
48
options[ :libpath     ] = cmd_options.lib_inc.flatten if cmd_options.lib_inc.size > 0
49
options[ :logger_out  ] = cmd_options.log_out
50
 
51
##
52
# initialize SOCMaker core
53
#   this sets up logging and parses all yaml files
54
#   found in the configure path (see also soc_maker_conf.rb)
55
SOCMaker::load( options )
56
 
57
# Print license info
58
puts SOCMaker::conf[ :LIC ] + "\n\n"
59
 
60
 
61
 
62
cli = SOCMaker::Cli::instance
63
if ARGF.filename != '-'
64
  ARGF.each do |line|
65
    cli.process_cmd line
66
  end
67
end
68
cli.run
69
 
70
# vim: noai:ts=2:sw=2
71
 

powered by: WebSVN 2.1.0

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