Skip to content

Commit a2e9d3f

Browse files
logout --remove; hint at upgrade when update has nothing to change
1 parent 2c0ec03 commit a2e9d3f

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 0.5.2 — unreleased
4+
5+
- `adolens logout --connection <name> --remove` removes the whole connection: the PAT, the settings entry and its
6+
metadata cache (a new default is picked when one connection is left).
7+
- `adolens update` without anything to change says it changes work items and points to `adolens upgrade --install`
8+
for updating ADO Lens itself.
9+
310
## 0.5.1 — 2026-10-15
411

512
- An icon: the program, the installer, Settings → Apps, the Start menu and the Claude Desktop extension.

‎src/AdoLens/Cli.cs‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public static void PrintUsage() => Console.WriteLine("""
2323
--org <name|url> --project <name> --team <name> --connection <name>
2424
--pat-stdin (read the PAT from standard input) --default (make it the default connection)
2525
logout remove the stored PAT of a connection --connection <name> | --all
26+
--remove: also the connection itself and its metadata cache
2627
connections list the connections
2728
config show or change settings
2829
--connection <name> --project <name> --team <name> (defaults of a connection)
@@ -196,6 +197,23 @@ public int Logout()
196197
Console.WriteLine(CredentialStore.Delete(name)
197198
? $"removed {CredentialStore.TargetFor(name)} from Windows Credential Manager"
198199
: $"no stored PAT for connection '{name}'");
200+
if (!cl.Flag("remove")) return 0;
201+
202+
// --remove: the whole connection - settings entry and its metadata cache, not only the PAT.
203+
var key = settings.Connections.Keys.FirstOrDefault(k => k.Equals(name, StringComparison.OrdinalIgnoreCase));
204+
if (key is null) { Console.WriteLine($"no connection '{name}' in the settings"); return 0; }
205+
settings.Connections.Remove(key);
206+
if (string.Equals(settings.DefaultConnection, key, StringComparison.OrdinalIgnoreCase))
207+
settings.DefaultConnection = settings.Connections.Count == 1 ? settings.Connections.Keys.First() : null;
208+
settings.Save(SettingsPath);
209+
Console.WriteLine($"removed connection '{key}' from {SettingsPath}" +
210+
(settings.DefaultConnection is { } d ? $"; default connection: {d}" : settings.Connections.Count > 1 ? "; set a default with 'adolens config --default-connection <name>'" : ""));
211+
var meta = Path.Combine(Settings.DataDir, "meta");
212+
foreach (var f in Directory.Exists(meta) ? Directory.GetFiles(meta, key + ".db*") : [])
213+
{
214+
try { File.Delete(f); }
215+
catch (IOException) { Console.WriteLine($"note: {f} is in use (an open Claude session) - delete it later"); }
216+
}
199217
return 0;
200218
}
201219

@@ -443,6 +461,14 @@ public async Task<int> UpdateAsync()
443461
Tags = cl.Opt("tags"), Fields = FieldOptions(),
444462
};
445463
var ids = cl.Opt("ids") ?? (cl.Positional.Count > 0 ? string.Join(';', cl.Positional) : null);
464+
var wiql = cl.Peek("wiql");
465+
if (ids is null && wiql is null && r.IsEmpty && cl.Peek("comment") is null)
466+
{
467+
// "update" alone is easily taken for updating the program.
468+
Console.Error.WriteLine("update changes work items: adolens update <ids> --state <s> | --field \"Name=Value\" | --comment <text>…");
469+
Console.Error.WriteLine("to update ADO Lens itself: adolens upgrade --install");
470+
return 2;
471+
}
446472
Print(await WorkQueries.UpdateAsync(lens, cl.Opt("connection"), ids, cl.Opt("wiql"), r, cl.Opt("comment"), cl.Opt("confirm"), lens.Settings.ConfirmBulkAbove));
447473
return 0;
448474
}

‎src/AdoLens/CommandLine.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public sealed partial class CommandLine
1717
["login"] = ["connection=", "org=", "project=", "team=", "pat-stdin", "pat-env=", "default"],
1818
["tests"] = ["connection=", "team=", "detail="],
1919
["test-create"] = ["connection=", "file=", "plan=", "suite="],
20-
["logout"] = ["connection=", "all"],
20+
["logout"] = ["connection=", "all", "remove"],
2121
["connections"] = [],
2222
["trace"] = ["connection=", "detail="],
2323
["pr"] = ["connection=", "project=", "repo=", "list=", "detail="],

0 commit comments

Comments
 (0)