@@ -17,57 +17,59 @@ def ship():
17
17
"""Manages ships."""
18
18
19
19
20
- @ship .command (' new' )
21
- @click .argument (' name' )
20
+ @ship .command (" new" )
21
+ @click .argument (" name" )
22
22
def ship_new (name ):
23
23
"""Creates a new ship."""
24
- click .echo (' Created ship %s' % name )
24
+ click .echo (" Created ship %s" % name )
25
25
26
26
27
- @ship .command ('move' )
28
- @click .argument ('ship' )
29
- @click .argument ('x' , type = float )
30
- @click .argument ('y' , type = float )
31
- @click .option ('--speed' , metavar = 'KN' , default = 10 ,
32
- help = 'Speed in knots.' )
27
+ @ship .command ("move" )
28
+ @click .argument ("ship" )
29
+ @click .argument ("x" , type = float )
30
+ @click .argument ("y" , type = float )
31
+ @click .option ("--speed" , metavar = "KN" , default = 10 , help = "Speed in knots." )
33
32
def ship_move (ship , x , y , speed ):
34
33
"""Moves SHIP to the new location X,Y."""
35
- click .echo (' Moving ship %s to %s,%s with speed %s' % (ship , x , y , speed ))
34
+ click .echo (" Moving ship %s to %s,%s with speed %s" % (ship , x , y , speed ))
36
35
37
36
38
- @ship .command (' shoot' )
39
- @click .argument (' ship' )
40
- @click .argument ('x' , type = float )
41
- @click .argument ('y' , type = float )
37
+ @ship .command (" shoot" )
38
+ @click .argument (" ship" )
39
+ @click .argument ("x" , type = float )
40
+ @click .argument ("y" , type = float )
42
41
def ship_shoot (ship , x , y ):
43
42
"""Makes SHIP fire to X,Y."""
44
- click .echo (' Ship %s fires to %s,%s' % (ship , x , y ))
43
+ click .echo (" Ship %s fires to %s,%s" % (ship , x , y ))
45
44
46
45
47
- @cli .group (' mine' , cls = DYMGroup )
46
+ @cli .group (" mine" , cls = DYMGroup )
48
47
def mine ():
49
48
"""Manages mines."""
50
49
51
50
52
- @mine .command ('set' )
53
- @click .argument ('x' , type = float )
54
- @click .argument ('y' , type = float )
55
- @click .option ('ty' , '--moored' , flag_value = 'moored' ,
56
- default = True ,
57
- help = 'Moored (anchored) mine. Default.' )
58
- @click .option ('ty' , '--drifting' , flag_value = 'drifting' ,
59
- help = 'Drifting mine.' )
51
+ @mine .command ("set" )
52
+ @click .argument ("x" , type = float )
53
+ @click .argument ("y" , type = float )
54
+ @click .option (
55
+ "ty" ,
56
+ "--moored" ,
57
+ flag_value = "moored" ,
58
+ default = True ,
59
+ help = "Moored (anchored) mine. Default." ,
60
+ )
61
+ @click .option ("ty" , "--drifting" , flag_value = "drifting" , help = "Drifting mine." )
60
62
def mine_set (x , y , ty ):
61
63
"""Sets a mine at a specific coordinate."""
62
- click .echo (' Set %s mine at %s,%s' % (ty , x , y ))
64
+ click .echo (" Set %s mine at %s,%s" % (ty , x , y ))
63
65
64
66
65
- @mine .command (' remove' )
66
- @click .argument ('x' , type = float )
67
- @click .argument ('y' , type = float )
67
+ @mine .command (" remove" )
68
+ @click .argument ("x" , type = float )
69
+ @click .argument ("y" , type = float )
68
70
def mine_remove (x , y ):
69
71
"""Removes a mine at a specific coordinate."""
70
- click .echo (' Removed mine at %s,%s' % (x , y ))
72
+ click .echo (" Removed mine at %s,%s" % (x , y ))
71
73
72
74
73
75
if __name__ == "__main__" :
0 commit comments