View | Details | Raw Unified | Return to bug 198055
Collapse All | Expand All

(-)Makefile (-2 / +1 lines)
Lines 2-9 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	clamp
4
PORTNAME=	clamp
5
PORTVERSION=	0.6.3
5
PORTVERSION=	0.6.4
6
PORTREVISION=	1
7
CATEGORIES=	devel ruby
6
CATEGORIES=	devel ruby
8
MASTER_SITES=	RG
7
MASTER_SITES=	RG
9
8
(-)distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (rubygem/clamp-0.6.3.gem) = 6e5feb738879f3ec8e74ac1d9a6339c316a65fdc054ef587851b0397ced1bab8
1
SHA256 (rubygem/clamp-0.6.4.gem) = e806278bee5df0aeaa7f15c55405a4d39ffe6182a1292c21462e1b771b60e138
2
SIZE (rubygem/clamp-0.6.3.gem) = 24064
2
SIZE (rubygem/clamp-0.6.4.gem) = 24576
(-)files/patch-i18n (-9 / +35 lines)
Lines 1-7 Link Here
1
diff --git a/clamp-0.6.3.gemspec b/clamp-0.6.3.gemspec
1
diff --git a/clamp-0.6.4.gemspec b/clamp-0.6.4.gemspec
2
index 8f51cc3..acab485 100644
2
index 8f51cc3..acab485 100644
3
--- clamp-0.6.3.gemspec
3
--- clamp-0.6.4.gemspec
4
+++ clamp-0.6.3.gemspec
4
+++ clamp-0.6.4.gemspec
5
@@ -43,6 +43,7 @@
5
@@ -43,6 +43,7 @@
6
 - lib/clamp/command.rb
6
 - lib/clamp/command.rb
7
 - lib/clamp/errors.rb
7
 - lib/clamp/errors.rb
Lines 15-21 Link Here
15
index 8f51cc3..acab485 100644
15
index 8f51cc3..acab485 100644
16
--- lib/clamp/attribute/instance.rb
16
--- lib/clamp/attribute/instance.rb
17
+++ lib/clamp/attribute/instance.rb
17
+++ lib/clamp/attribute/instance.rb
18
@@ -72,7 +72,7 @@ def default_from_environment
18
@@ -69,7 +69,7 @@ def default_from_environment
19
         begin
19
         begin
20
           take(value)
20
           take(value)
21
         rescue ArgumentError => e
21
         rescue ArgumentError => e
Lines 46-54 Link Here
46
index e09731a..1e57530 100644
46
index e09731a..1e57530 100644
47
--- lib/clamp/help.rb
47
--- lib/clamp/help.rb
48
+++ lib/clamp/help.rb
48
+++ lib/clamp/help.rb
49
@@ -61,7 +61,7 @@ def string
49
@@ -1,4 +1,5 @@
50
 require 'stringio'
51
+require 'clamp/messages'
52
 
53
 module Clamp
54
 
55
@@ -41,12 +42,12 @@ def help(invocation_path, builder = Builder.new)
56
       help.add_usage(invocation_path, usage_descriptions)
57
       help.add_description(description)
58
       if has_parameters?
59
-        help.add_list("Parameters", parameters)
60
+        help.add_list(Clamp.message(:parameters_heading), parameters)
50
       end
61
       end
62
       if has_subcommands?
63
-        help.add_list("Subcommands", recognised_subcommands)
64
+        help.add_list(Clamp.message(:subcommands_heading), recognised_subcommands)
65
       end
66
-      help.add_list("Options", recognised_options)
67
+      help.add_list(Clamp.message(:options_heading), recognised_options)
68
       help.string
69
     end
51
 
70
 
71
@@ -61,7 +62,7 @@ def string
72
       end
73
 
52
       def add_usage(invocation_path, usage_descriptions)
74
       def add_usage(invocation_path, usage_descriptions)
53
-        puts "Usage:"
75
-        puts "Usage:"
54
+        puts usage_heading
76
+        puts usage_heading
Lines 55-61 Link Here
55
         usage_descriptions.each do |usage|
77
         usage_descriptions.each do |usage|
56
           puts "    #{invocation_path} #{usage}".rstrip
78
           puts "    #{invocation_path} #{usage}".rstrip
57
         end
79
         end
58
@@ -87,6 +87,12 @@ def add_list(heading, items)
80
@@ -87,6 +88,12 @@ def add_list(heading, items)
59
         end
81
         end
60
       end
82
       end
61
 
83
 
Lines 62-68 Link Here
62
+      protected
84
+      protected
63
+
85
+
64
+      def usage_heading
86
+      def usage_heading
65
+        "Usage:"
87
+        Clamp.message(:usage_heading) + ":"
66
+      end
88
+      end
67
+
89
+
68
       private
90
       private
Lines 73-79 Link Here
73
index 0000000..61cce94
95
index 0000000..61cce94
74
--- /dev/null
96
--- /dev/null
75
+++ lib/clamp/messages.rb
97
+++ lib/clamp/messages.rb
76
@@ -0,0 +1,39 @@
98
@@ -0,0 +1,43 @@
77
+module Clamp
99
+module Clamp
78
+
100
+
79
+  def self.messages=(messages)
101
+  def self.messages=(messages)
Lines 96-102 Link Here
96
+      :env_argument_error => "$%<env>s: %<message>s",
118
+      :env_argument_error => "$%<env>s: %<message>s",
97
+      :unrecognised_option => "Unrecognised option '%<switch>s'",
119
+      :unrecognised_option => "Unrecognised option '%<switch>s'",
98
+      :no_such_subcommand => "No such sub-command '%<name>s'",
120
+      :no_such_subcommand => "No such sub-command '%<name>s'",
99
+      :no_value_provided => "no value provided"
121
+      :no_value_provided => "no value provided",
122
+      :usage_heading => "Usage",
123
+      :parameters_heading => "Parameters",
124
+      :subcommands_heading => "Subcommands",
125
+      :options_heading => "Options"
100
+    }
126
+    }
101
+  end
127
+  end
102
+
128
+

Return to bug 198055