1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-30 10:52:00 +00:00

remote: improve and document the rename command (#3973)

This commit is contained in:
Luukas Pörtfors 2022-10-19 02:02:23 +03:00 committed by GitHub
parent ad77140035
commit 9313e42866
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -2406,8 +2406,6 @@ static tr_variant* ensure_tset(tr_variant* tset)
return tr_variantDictAddDict(tset, Arguments, 1);
}
static char rename_from[4096];
static int processArgs(char const* rpcurl, int argc, char const* const* argv, Config& config)
{
int status = EXIT_SUCCESS;
@ -2415,6 +2413,7 @@ static int processArgs(char const* rpcurl, int argc, char const* const* argv, Co
auto sset = tr_variant{};
auto tset = tr_variant{};
auto tadd = tr_variant{};
std::string rename_from;
for (;;)
{
@ -3167,18 +3166,19 @@ static int processArgs(char const* rpcurl, int argc, char const* const* argv, Co
{
auto top = tr_variant{};
tr_variantInitDict(&top, 2);
tr_variantDictAddStr(&top, TR_KEY_method, "rename");
tr_variantDictAddStr(&top, TR_KEY_method, "torrent-rename-path"sv);
auto* args = tr_variantDictAddDict(&top, Arguments, 3);
tr_variantDictAddStr(args, TR_KEY_path, rename_from);
tr_variantDictAddStr(args, TR_KEY_name, optarg);
addIdArg(args, config);
status |= flush(rpcurl, &top, config);
rename_from.clear();
break;
}
case 965:
{
tr_strlcpy(rename_from, optarg, sizeof(rename_from));
rename_from = optarg;
break;
}

View file

@ -258,6 +258,10 @@ Remove the current torrent(s) and delete their downloaded data.
Reannounce the current torrent(s). This is the same as the GUI's "ask tracker for more peers" button.
.It Fl -move
Move the current torrents' data from their current locations to the specified directory.
.It Fl -rename Ar newname
Rename files or root folder of a torrent
.It Fl -path Ar oldname
Provide original path for the rename command
.It Fl -unix-socket
Connect using a Unix domain socket.
.It Fl -find
@ -363,6 +367,10 @@ List all torrents with name containing "def" or with label "abc":
.Bd -literal -offset indent
$ transmission-remote -t $(\ transmission-remote \-F n:def \-ids )$(\ transmission-remote \-F l:abc \-ids ) \-l
.Ed
Rename torrent root folder from "test1/examplefile.txt" to "test2/examplefile.txt"
.Bd -literal -offset indent
$ transmission-remote -t1 --path test1 --rename test2
.Ed
Set download and upload limits to 400 kB/sec and 60 kB/sec:
.Bd -literal -offset indent
$ transmission-remote \-d400 \-u60