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.
- checksums.yaml +4 -4
- data/bin/pycplus +45 -42
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f3bc5bfe8923bf561c4a2b3167a862151f1487d62b84bb1587f9f07b0433c63
|
4
|
+
data.tar.gz: 4872ec376c3501b869ed773b0a535b894abe35d9af05af81784cf081a34696dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
11
|
-
|
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
|
-
|
24
|
+
# Parse other command-line options using OptionParser
|
25
|
+
options = {}
|
26
|
+
OptionParser.new do |opts|
|
20
27
|
|
21
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
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
|
-
|
34
|
-
|
35
|
-
|
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
|
-
|
40
|
-
|
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
|
-
|
43
|
-
|
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
|
-
|
50
|
-
|
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
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
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:
|
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
|