pycplus 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/pycplus +45 -42
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ba4de43decc549bf60ae97669e59b7e8dc597897d9f9f943c9547e93f260880
4
- data.tar.gz: a8e6c2e1815da2725a6f5af2841a6d9ff7db0bf5ec58fd6a05ccde637df12a96
3
+ metadata.gz: 5f3bc5bfe8923bf561c4a2b3167a862151f1487d62b84bb1587f9f07b0433c63
4
+ data.tar.gz: 4872ec376c3501b869ed773b0a535b894abe35d9af05af81784cf081a34696dc
5
5
  SHA512:
6
- metadata.gz: 1fdf3493c38f21ed5d515f1b4ea4c80849913ac6a4b6398bc6000a27df445ffa8161222cc9115d9bae0162b06809dc5531576d5182e0525ca998f74ad3f6895d
7
- data.tar.gz: d51d284dac74989f444902c43ff177e706daf2887bf4e6fd80aae0aa250c744d6b6f9d979d61862ecc8353195b12c91cfaeacec0a8e77cd7eb974c759aafa412
6
+ metadata.gz: 84dd3244332bfe07a86e8448276f0bdb7ebd5318696ba882ab707fbb8e82aaeba63e40c6cc531a166012461df549a47bede2e9a07bab81cf58255f1d6faeb784
7
+ data.tar.gz: 3002a3bc7ce8f595fd1f84371796cd4ad0ce9de8ad4f0d08c5dbe7278685c9278f8be3fbc7f7d8618b923ef03af483c0e0f4d65cda9b934918f3bc3ff0c918b6
data/bin/pycplus CHANGED
@@ -7,59 +7,62 @@ require_relative '../lib/pcpparse'
7
7
 
8
8
  # Method to print gem version
9
9
  def print_version
10
- spec = Gem.loaded_specs['pycplus']
11
- puts "#{spec.name} version #{spec.version}"
10
+ begin
11
+ spec = Gem.loaded_specs['pycplus']
12
+ puts "#{spec.name} version #{spec.version}"
13
+ rescue
14
+ begin
15
+ spec = Gem::Specification.load('../pycplus.gemspec')
16
+ puts "#{spec.name} version #{spec.version}"
17
+ rescue
18
+ puts "Error: Unable to find version for pycplus gem"
19
+ end
20
+ end
12
21
  end
13
22
 
14
- def main
15
- # Parse other command-line options using OptionParser
16
- options = {}
17
- OptionParser.new do |opts|
18
23
 
19
- opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} [options] filename"
24
+ # Parse other command-line options using OptionParser
25
+ options = {}
26
+ OptionParser.new do |opts|
20
27
 
21
- # version is handled as a special case as it doesn't make sense to use it alongside the other options
22
- opts.on("-v", "--version", "Display version information") do
23
- print_version
24
- exit
25
- end
28
+ opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} [options] filename"
26
29
 
27
- opts.on("-d", "--debug", "Enable debug mode") do
28
- options[:debug] = true
29
- print("dhsdhshdshds")
30
- end
31
- end.parse!
30
+ # version is handled as a special case as it doesn't make sense to use it alongside the other options
31
+ opts.on("-v", "--version", "Display version information") do
32
+ print_version
33
+ exit
34
+ end
32
35
 
33
- # Check if a filename argument is provided
34
- if ARGV.empty?
35
- puts "Error: No filename or arguments provided."
36
- exit 1
36
+ opts.on("-d", "--debug", "Enable debug mode") do
37
+ options[:debug] = true
38
+ print("dhsdhshdshds")
37
39
  end
40
+ end.parse!
38
41
 
39
- filename = ARGV.shift
40
- @lang_parser = Pycplus.new
42
+ # Check if a filename argument is provided
43
+ if ARGV.empty?
44
+ puts "Error: No filename or arguments provided."
45
+ exit 1
46
+ end
41
47
 
42
- # Enable debug mode if specified
43
- if options[:debug]
44
- @lang_parser.log(true)
45
- else
46
- @lang_parser.log(false)
47
- end
48
+ filename = ARGV.shift
49
+ @lang_parser = Pycplus.new
48
50
 
49
- if File.file?(filename)
50
- extension = File.extname(filename)
51
+ # Enable debug mode if specified
52
+ if options[:debug]
53
+ @lang_parser.log(true)
54
+ else
55
+ @lang_parser.log(false)
56
+ end
51
57
 
52
- if extension == ".pcp"
53
- @lang_parser.parse_file(filename)
54
- else
55
- puts "Error: File is not a .pcp file. Please provide a file with the correct extension."
56
- end
58
+ if File.file?(filename)
59
+ extension = File.extname(filename)
60
+
61
+ if extension == ".pcp"
62
+ @lang_parser.parse_file(filename)
57
63
  else
58
- puts "Error: Unable to find file #{filename}"
64
+ puts "Error: File is not a .pcp file. Please provide a file with the correct extension."
59
65
  end
66
+ else
67
+ puts "Error: Unable to find file #{filename}"
60
68
  end
61
-
62
-
63
- if __FILE__ == $PROGRAM_NAME
64
- main
65
- end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pycplus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes