From 291d30239de190ae196e21b50b2b745c0353df09 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 11 Jul 2008 18:14:09 +0000 Subject: [PATCH] (daemon) more cleanup work on remote's help and manpage --- daemon/remote.c | 41 ++++++++-------- daemon/transmission-remote.1 | 91 +++++++++++++++++++++--------------- 2 files changed, 72 insertions(+), 60 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 59114bb32..27933d16b 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -45,18 +45,7 @@ getUsage( void ) " "MY_NAME" [port] [options]\n" " "MY_NAME" [host:port] [options]\n" "\n" -"Notes:\n" -" can be 'all', a single index, or a comma-separated list.\n" -" can be 'all', a torrent id or hash string, or a comma-separated list of ids and hash strings.\n" -"\n" -"Examples:\n" -" \""MY_NAME" -l\" (list all torrents)\n" -" \""MY_NAME" -tall --start\" (start all torrents)\n" -" \""MY_NAME" --add ~/Desktop/*torrent\" (add all the torrent files in $HOME/Desktop)\n" -" \""MY_NAME" -t1 -i\" (get detailed information on the torrent whose id is '1')\n" -" \""MY_NAME" -t1 -Gall -g2,4,6\" (same torrent; only download the second, fourth, and sixth files)\n" -" \""MY_NAME" -tall -ph1,2\" (set all torrent's first two files' priorities to high)\n" -" \""MY_NAME" -tall -pnall\" (set all torrent's files' priorities to normal)"; +"See the man page for detailed explanations and many examples."; } static tr_option opts[] = @@ -65,8 +54,10 @@ static tr_option opts[] = { 'b', "debug", "Print debugging information", "b", 0, NULL }, { 'd', "downlimit", "Set the maximum download speed in KB/s", "d", 1, "" }, { 'D', "no-downlimit", "Don't limit the download speed", "D", 0, NULL }, - { 'e', "encryption", "Set encryption mode [required, preferred, tolerated]", "e", 1, "" }, - { 'f', "files", "Get a file list for the current torrent(s)", "f", 0, NULL }, + { 910, "encryption-required", "Encrypt all peer connections", "er", 0, NULL }, + { 911, "encryption-preferred", "Prefer encrypted peer connections", "ep", 0, NULL }, + { 912, "encryption-tolerated", "Prefer unencrypted peer connections", "et", 0, NULL }, + { 'f', "files", "List the current torrent's files", "f", 0, NULL }, { 'g', "get", "Mark files for download", "g", 1, "" }, { 'G', "no-get", "Mark files for not downloading", "G", 1, "" }, { 'h', "help", "Show this help page and exit", "h", 0, NULL }, @@ -74,11 +65,11 @@ static tr_option opts[] = { 'l', "list", "List all torrents", "l", 0, NULL }, { 'm', "portmap", "Enable portmapping via NAT-PMP or UPnP", "m", 0, NULL }, { 'M', "no-portmap", "Disable portmapping", "M", 0, NULL }, - { 'n', "auth", "Set username for authentication", "n", 1, ":" }, + { 'n', "auth", "Set username for authentication", "n", 1, "" }, { 'p', "port", "Port to listen for incoming peers", "p", 1, "" }, - { 900, "priority-high", "Set one or more files' priority as high", "ph", 1, "" }, - { 901, "priority-normal", "Set one or more files' priority as normal", "pn", 1, "" }, - { 902, "priority-normal", "Set one or more files' priority as low", "pl", 1, "" }, + { 900, "priority-high", "Set the files' priorities as high", "ph", 1, "" }, + { 901, "priority-normal", "Set the files' priorities as normal", "pn", 1, "" }, + { 902, "priority-normal", "Set the files' priorities as low", "pl", 1, "" }, { 'r', "remove", "Remove the current torrent(s)", "r", 0, NULL }, { 's', "start", "Start the current torrent(s)", "s", 0, NULL }, { 'S', "stop", "Stop the current torrent(s)", "S", 0, NULL }, @@ -86,7 +77,7 @@ static tr_option opts[] = { 'u', "uplimit", "Set the maximum upload speed in KB/s", "u", 1, "" }, { 'U', "no-uplimit", "Don't limit the upload speed", "U", 0, NULL }, { 'v', "verify", "Verify the current torrent(s)", "v", 0, NULL }, - { 'w', "download-dir", "Set the download folder for new torrents", "w", 1, "" }, + { 'w', "download-dir", "Set the default download folder", "w", 1, "" }, { 'x', "pex", "Enable peer exchange (PEX)", "x", 0, NULL }, { 'X', "no-pex", "Disable peer exchange (PEX)", "X", 0, NULL }, { 0, NULL, NULL, NULL, 0, NULL } @@ -224,9 +215,6 @@ readargs( int argc, const char ** argv ) case 'D': tr_bencDictAddStr( &top, "method", "session-set" ); tr_bencDictAddInt( args, "speed-limit-down-enabled", 0 ); break; - case 'e': tr_bencDictAddStr( &top, "method", "session-set" ); - tr_bencDictAddStr( args, "encryption", optarg ); - break; case 'f': tr_bencDictAddStr( &top, "method", "torrent-get" ); tr_bencDictAddInt( &top, "tag", TAG_FILES ); addIdArg( args, id ); @@ -321,6 +309,15 @@ readargs( int argc, const char ** argv ) addIdArg( args, id ); addFiles( args, "priority-low", optarg ); break; + case 910: tr_bencDictAddStr( &top, "method", "session-set" ); + tr_bencDictAddStr( args, "encryption", "required" ); + break; + case 911: tr_bencDictAddStr( &top, "method", "session-set" ); + tr_bencDictAddStr( args, "encryption", "preferred" ); + break; + case 912: tr_bencDictAddStr( &top, "method", "session-set" ); + tr_bencDictAddStr( args, "encryption", "tolerated" ); + break; default: fprintf( stderr, "got opt [%d]\n", (int)c ); showUsage( ); break; diff --git a/daemon/transmission-remote.1 b/daemon/transmission-remote.1 index fe02190a4..ecbdbfe1c 100644 --- a/daemon/transmission-remote.1 +++ b/daemon/transmission-remote.1 @@ -15,7 +15,9 @@ and .Op Fl b .Op Fl d Ar number .Op Fl D -.Op Fl e Ar mode +.Op Fl er +.Op Fl ep +.Op Fl et .Op Fl f .Op Fl g Ar files .Op Fl G Ar files @@ -69,11 +71,11 @@ kilobytes per second. .It Fl D Fl -no-downlimit Remove the download limit. -.It Fl e Fl -encryption Ar required -Require all peer connections to be encrypted. -.It Fl e Fl -encryption Ar preferred +.It Fl er Fl -encryption-required +Encrypt all peer connections. +.It Fl ep Fl -encryption-preferred Prefer encrypted peer connections. -.It Fl e Fl -encryption Ar tolerated +.It Fl et Fl -encryption-tolerated Prefer unencrypted peer connections. .It Fl f Fl -files @@ -103,8 +105,9 @@ Enable portmapping via NAT-PMP or UPnP .It Fl M Fl -no-portmap Disable portmapping -.It Fl n Fl -auth Ar user:pass -.Ar Username +.It Fl n Fl -auth Ar username:password +Set the +.Ar username and .Ar password for authentication @@ -149,6 +152,8 @@ will apply following requests to all torrents, while specific torrents can be ch .Ar id or .Ar hash . +To set more than one current torrent, joined their ids or hashes together in a comma-delimited list, +such as "-t1,2,3" .It Fl u Fl -uplimit Ar limit Limit the upload speed to @@ -165,54 +170,64 @@ Use .Ar directory as the default location for newly added torrents to download files to. -.It Fl x +.It Fl x Fl -pex Enable peer exchange (PEX). -.It Fl X +.It Fl X Fl -no-pex Disable peer exchange (PEX). .El .Sh EXAMPLES -List all torrents: -.Pp -.Dl $ transmission-remote -l -.Pp +List all torrents' IDs and states: +.Bd -literal -offset indent +$ transmission-remote -l +.Ed + +List all torrents from a remote session that requires authentication: +.Bd -literal -offset indent +$ transmission-remote host:9091 --auth=username:password -l +.Ed Start all torrents: -.Pp -.Dl $ transmission-remote -tall --start -.Pp +.Bd -literal -offset indent +$ transmission-remote -tall --start +.Ed + +Add two torrents: +.Bd -literal -offset indent +$ transmission-remote -a one.torrent two.torrent +.Ed + +Add all torrents in ~/Desktop: +.Bd -literal -offset indent +$ transmission-remote -a ~/Desktop/*torrent +.Ed Get detailed information on the torrent whose ID is '1': -.Pp -.Dl $ transmission-remote -t1 -i -.Pp +.Bd -literal -offset indent +$ transmission-remote -t1 -i" +.Ed -Only download the second, fourth, and sixth files of the torrent whose ID is '1': -.Pp -.Dl $ transmission-remote -t1 -Gall -g2,4,6 -.Pp +Download only its second and fourth files: +.Bd -literal -offset indent +$ transmission-remote -t1 -Gall -g2,4" +.Ed Set all torrents' first two files' priorities to high: -.Pp -.Dl $ transmission-remote -t1 -ph1,2 -.Pp +.Bd -literal -offset indent +$ transmission-remote -tall -ph1,2" +.Ed Set all torrents' files' priorities to normal: -.Pp -.Dl $ transmission-remote -tall -pnall -.Pp +.Bd -literal -offset indent +$ transmission-remote -tall -pnall" +.Ed Set download and upload limits to 100 KiB/sec and 20 KiB/sec: -.Pp -.Dl $ transmission-remote -d 100 -u 20 -.Dl $ transmission-remote -d=100 -u=20 -.Pp - -Add two torrents: -.Pp -.Dl $ transmission-remote -a one.torrent two.torrent -.Pp +.Bd -literal -offset indent +$ transmission-remote -d100 -u20 +$ transmission-remote --downlimit=100 --uplimit=20 +.Bd -literal -offset indent .Sh AUTHORS .An -nosplit -- 2.40.0