Hex Artifact Content
Not logged in

Artifact e7755176c98ca214624b2626983f1349cfa18fd3:


0000: 75 73 65 20 63 61 72 67 6f 3a 3a 75 74 69 6c 3a  use cargo::util:
0010: 3a 7b 43 6c 69 52 65 73 75 6c 74 2c 20 43 6c 69  :{CliResult, Cli
0020: 45 72 72 6f 72 2c 20 43 6f 6e 66 69 67 2c 20 68  Error, Config, h
0030: 75 6d 61 6e 7d 3b 0a 0a 23 5b 64 65 72 69 76 65  uman};..#[derive
0040: 28 52 75 73 74 63 44 65 63 6f 64 61 62 6c 65 29  (RustcDecodable)
0050: 5d 0a 70 75 62 20 73 74 72 75 63 74 20 4f 70 74  ].pub struct Opt
0060: 69 6f 6e 73 3b 0a 0a 70 75 62 20 63 6f 6e 73 74  ions;..pub const
0070: 20 55 53 41 47 45 3a 20 26 27 73 74 61 74 69 63   USAGE: &'static
0080: 20 73 74 72 20 3d 20 22 0a 47 65 74 20 73 6f 6d   str = ".Get som
0090: 65 20 68 65 6c 70 20 77 69 74 68 20 61 20 63 61  e help with a ca
00a0: 72 67 6f 20 63 6f 6d 6d 61 6e 64 2e 0a 0a 55 73  rgo command...Us
00b0: 61 67 65 3a 0a 20 20 20 20 63 61 72 67 6f 20 68  age:.    cargo h
00c0: 65 6c 70 20 3c 63 6f 6d 6d 61 6e 64 3e 0a 20 20  elp <command>.  
00d0: 20 20 63 61 72 67 6f 20 68 65 6c 70 20 2d 68 20    cargo help -h 
00e0: 7c 20 2d 2d 68 65 6c 70 0a 0a 4f 70 74 69 6f 6e  | --help..Option
00f0: 73 3a 0a 20 20 20 20 2d 68 2c 20 2d 2d 68 65 6c  s:.    -h, --hel
0100: 70 20 20 20 20 20 20 20 20 20 20 50 72 69 6e 74  p          Print
0110: 20 74 68 69 73 20 6d 65 73 73 61 67 65 0a 22 3b   this message.";
0120: 0a 0a 70 75 62 20 66 6e 20 65 78 65 63 75 74 65  ..pub fn execute
0130: 28 5f 3a 20 4f 70 74 69 6f 6e 73 2c 20 5f 3a 20  (_: Options, _: 
0140: 26 43 6f 6e 66 69 67 29 20 2d 3e 20 43 6c 69 52  &Config) -> CliR
0150: 65 73 75 6c 74 20 7b 0a 20 20 20 20 2f 2f 20 54  esult {.    // T
0160: 68 69 73 20 69 73 20 61 20 64 75 6d 6d 79 20 63  his is a dummy c
0170: 6f 6d 6d 61 6e 64 20 6a 75 73 74 20 73 6f 20 74  ommand just so t
0180: 68 61 74 20 60 63 61 72 67 6f 20 68 65 6c 70 20  hat `cargo help 
0190: 68 65 6c 70 60 20 77 6f 72 6b 73 2e 0a 20 20 20  help` works..   
01a0: 20 2f 2f 20 54 68 65 20 61 63 74 75 61 6c 20 64   // The actual d
01b0: 65 6c 65 67 61 74 69 6f 6e 20 6f 66 20 68 65 6c  elegation of hel
01c0: 70 20 66 6c 61 67 20 74 6f 20 73 75 62 63 6f 6d  p flag to subcom
01d0: 6d 61 6e 64 73 20 69 73 20 68 61 6e 64 6c 65 64  mands is handled
01e0: 20 62 79 20 74 68 65 0a 20 20 20 20 2f 2f 20 63   by the.    // c
01f0: 61 72 67 6f 20 63 6f 6d 6d 61 6e 64 2e 0a 20 20  argo command..  
0200: 20 20 45 72 72 28 43 6c 69 45 72 72 6f 72 3a 3a    Err(CliError::
0210: 6e 65 77 28 68 75 6d 61 6e 28 22 68 65 6c 70 20  new(human("help 
0220: 63 6f 6d 6d 61 6e 64 20 73 68 6f 75 6c 64 20 6e  command should n
0230: 6f 74 20 62 65 20 65 78 65 63 75 74 65 64 20 64  ot be executed d
0240: 69 72 65 63 74 6c 79 22 29 2c 20 31 30 31 29 29  irectly"), 101))
0250: 0a 7d 0a                                         .}.