GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: a tiny graphical app kit for ruby
Homepage: http://code.whytheluckystiff.net/shoes
Clone URL: git://github.com/why/shoes.git
* lib/shoes.rb: messing around with adding some commandline args to shoes.
why (author)
Thu Aug 23 12:56:19 -0700 2007
commit  616ecc6f936c14d24c27c8afa727328b3c8ec496
tree    ff1f1c0dd5132512f30bce79f8bb752e99f65b02
parent  b361b79b2e40fac6fa9319da165b7dd3e7d8518f
...
27
28
29
 
30
31
32
...
27
28
29
30
31
32
33
0
@@ -27,6 +27,7 @@ main(argc, argv)
0
   app->path = SHOE_ALLOC_N(char, SHOES_BUFSIZE);
0
   GetModuleFileName(NULL, (LPSTR)app->path, SHOES_BUFSIZE);
0
 #else
0
+ ruby_set_argv(argc, argv);
0
   app->path = argv[0];
0
   if (argc > 1)
0
     uri = argv[1];
...
4
5
6
 
7
8
 
 
9
10
11
...
16
17
18
 
 
 
 
 
 
 
 
 
 
 
 
19
20
21
...
48
49
50
 
 
 
 
 
51
52
53
...
4
5
6
7
8
9
10
11
12
13
14
...
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
...
63
64
65
66
67
68
69
70
71
72
73
0
@@ -4,8 +4,11 @@
0
 # using Shoes.
0
 #
0
 require 'open-uri'
0
+require 'optparse'
0
 require 'shoes/shy'
0
 
0
+ARGV.shift
0
+
0
 class Range
0
   def rand
0
     conv = (self.end === Integer && self.begin === Integer ? :to_i : :to_f)
0
@@ -16,6 +19,18 @@ end
0
 class Shoes
0
   @mounts = []
0
 
0
+ OPTS = OptionParser.new do |opts|
0
+ opts.banner = "Usage: shoes [options] (app.rb or app.shy)"
0
+
0
+ opts.separator ""
0
+ opts.separator "Specific options:"
0
+
0
+ opts.on("-s", "--shy DIRECTORY",
0
+ "Compress a directory into a Shoes YAML (SHY) archive.") do |s|
0
+ p s
0
+ end
0
+ end
0
+
0
   NoScript = proc do
0
     script = ask_open_file
0
     Shoes.load(script)
0
@@ -48,6 +63,11 @@ class Shoes
0
     end
0
   end
0
 
0
+ def self.args!
0
+ OPTS.parse! ARGV
0
+ ARGV[0]
0
+ end
0
+
0
   def self.load(path)
0
     path = File.expand_path(path.gsub(/\\/, "/"))
0
     if path =~ /\.shy$/
...
843
844
845
846
 
847
848
849
...
843
844
845
 
846
847
848
849
0
@@ -843,7 +843,7 @@ shoes_app_load(shoes_app *app, char *uri)
0
   {
0
     sprintf(bootup,
0
       "begin;"
0
- "Shoes.load(%%q<%s>);"
0
+ "Shoes.load(Shoes.args!);"
0
       "rescue Object => e;"
0
         SHOES_META
0
           EXC_RUN
...
9
10
11
 
12
13
...
9
10
11
12
13
14
0
@@ -9,5 +9,6 @@ typedef unsigned long shoes_code;
0
 
0
 #define SHOES_OK 0
0
 #define SHOES_FAIL 1
0
+#define SHOES_QUIT 2
0
 
0
 #endif

Comments

    No one has commented yet.