Skip to content

Commit c41ee72

Browse files
author
root
committed
Rename CLI from bmw to metal
1 parent 19ba0ca commit c41ee72

5 files changed

Lines changed: 91 additions & 91 deletions

File tree

‎.github/workflows/build-cli.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ jobs:
4949
shell: bash
5050
run: |
5151
mkdir -p ./artifacts
52-
cp ./cli-out/${{ matrix.rid }}/bmw${{ matrix.ext }} ./artifacts/bmw-${{ matrix.rid }}${{ matrix.ext }}
52+
cp ./cli-out/${{ matrix.rid }}/metal${{ matrix.ext }} ./artifacts/metal-${{ matrix.rid }}${{ matrix.ext }}
5353
5454
- name: Upload artifact
5555
uses: actions/upload-artifact@v4
5656
with:
57-
name: bmw-${{ matrix.rid }}
58-
path: ./artifacts/bmw-${{ matrix.rid }}${{ matrix.ext }}
57+
name: metal-${{ matrix.rid }}
58+
path: ./artifacts/metal-${{ matrix.rid }}${{ matrix.ext }}
5959

6060
collect:
6161
needs: build-cli
@@ -73,5 +73,5 @@ jobs:
7373
- name: Upload combined release
7474
uses: actions/upload-artifact@v4
7575
with:
76-
name: bmw-all-platforms
76+
name: metal-all-platforms
7777
path: ./all-binaries/

‎BackgroundUsage.md‎

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,58 +26,58 @@ This document details the REST API endpoints, Service Principal authentication,
2626

2727
---
2828

29-
## CLI Tool (`bmw`)
29+
## CLI Tool (`metal`)
3030

3131
BareMetalWeb includes a cross-platform CLI tool for managing entities from the command line. It compiles to native AOT binaries for Windows and Linux on x64, x86, ARM64, and ARM32.
3232

3333
### Installation
3434

35-
Download the binary for your platform from the GitHub Actions build artifacts (`bmw-all-platforms`). No runtime required — it's a self-contained native binary.
35+
Download the binary for your platform from the GitHub Actions build artifacts (`metal-all-platforms`). No runtime required — it's a self-contained native binary.
3636

3737
### Connection
3838

3939
```bash
4040
# Connect with API key
41-
bmw connect https://your-site.azurewebsites.net your-api-key
41+
metal connect https://your-site.azurewebsites.net your-api-key
4242

4343
# Or connect then login via device code flow (opens browser)
44-
bmw connect https://your-site.azurewebsites.net
45-
bmw login
44+
metal connect https://your-site.azurewebsites.net
45+
metal login
4646

4747
# Or login via device code (headless/SSH — displays code to enter manually)
48-
bmw login --outofband
48+
metal login --outofband
4949

5050
# Or login directly with credentials
51-
bmw login username password
51+
metal login username password
5252

5353
# Show current config
54-
bmw config
54+
metal config
5555
```
5656

57-
Configuration is stored in `~/.bmw/config.json`, session cookies in `~/.bmw/cookies`.
57+
Configuration is stored in `~/.metal/config.json`, session cookies in `~/.metal/cookies`.
5858

5959
### Commands
6060

6161
| Command | Description |
6262
|---------|-------------|
63-
| `bmw connect <url> [api-key]` | Set server URL and optional API key |
64-
| `bmw login` | Login via device code (opens browser) |
65-
| `bmw login --outofband` | Login via device code (no browser, shows code) |
66-
| `bmw login <user> <pass>` | Login with username/password |
67-
| `bmw config` | Show current configuration |
68-
| `bmw types` | List available entity types (via `/api/_meta`) |
69-
| `bmw list <type>` | List all entities of a type |
70-
| `bmw get <type> <id>` | Get a single entity |
71-
| `bmw create <type> k=v [k=v..]` | Create a new entity |
72-
| `bmw update <type> <id> k=v ..` | Partial update (PATCH) |
73-
| `bmw delete <type> <id>` | Delete an entity |
74-
| `bmw query <type> [params]` | Query with filters |
63+
| `metal connect <url> [api-key]` | Set server URL and optional API key |
64+
| `metal login` | Login via device code (opens browser) |
65+
| `metal login --outofband` | Login via device code (no browser, shows code) |
66+
| `metal login <user> <pass>` | Login with username/password |
67+
| `metal config` | Show current configuration |
68+
| `metal types` | List available entity types (via `/api/_meta`) |
69+
| `metal list <type>` | List all entities of a type |
70+
| `metal get <type> <id>` | Get a single entity |
71+
| `metal create <type> k=v [k=v..]` | Create a new entity |
72+
| `metal update <type> <id> k=v ..` | Partial update (PATCH) |
73+
| `metal delete <type> <id>` | Delete an entity |
74+
| `metal query <type> [params]` | Query with filters |
7575

7676
### Query Parameters
7777

7878
```bash
79-
bmw query to-do field=Title op=contains value=milk sort=Deadline dir=asc top=5
80-
bmw query to-do q=searchtext
79+
metal query to-do field=Title op=contains value=milk sort=Deadline dir=asc top=5
80+
metal query to-do q=searchtext
8181
```
8282

8383
### Discovery Endpoint

‎BareMetalWeb.CLI/BareMetalWeb.CLI.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<TrimMode>full</TrimMode>
1212
<SelfContained>true</SelfContained>
1313
<InvariantGlobalization>false</InvariantGlobalization>
14-
<AssemblyName>bmw</AssemblyName>
14+
<AssemblyName>metal</AssemblyName>
1515
<RootNamespace>BareMetalWeb.CLI</RootNamespace>
1616
<ServerGarbageCollection>false</ServerGarbageCollection>
1717
<GarbageCollectionAdaptationMode>0</GarbageCollectionAdaptationMode>

‎BareMetalWeb.CLI/Program.cs‎

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ internal sealed class MetaField
5050
internal static class Program
5151
{
5252
private static string ConfigDir => Path.Combine(
53-
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".bmw");
53+
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".metal");
5454
private static string ConfigPath => Path.Combine(ConfigDir, "config.json");
5555
private static string CookiePath => Path.Combine(ConfigDir, "cookies");
5656

@@ -115,7 +115,7 @@ static async Task<int> Main(string[] args)
115115
// --- connect ---
116116
static int Connect(string[] args)
117117
{
118-
if (args.Length < 1) return Help(1, "Usage: bmw connect <url> [api-key]");
118+
if (args.Length < 1) return Help(1, "Usage: metal connect <url> [api-key]");
119119
_config.Url = args[0].TrimEnd('/');
120120
_config.ApiKey = args.Length > 1 ? args[1] : "";
121121
SaveConfig();
@@ -129,11 +129,11 @@ static int Connect(string[] args)
129129
// --- login ---
130130
static async Task<int> Login(string[] args)
131131
{
132-
if (string.IsNullOrEmpty(_config.Url)) return Help(1, "Not connected. Run: bmw connect <url>");
132+
if (string.IsNullOrEmpty(_config.Url)) return Help(1, "Not connected. Run: metal connect <url>");
133133

134-
// bmw login --outofband → device code flow (no browser)
135-
// bmw login → device code flow (opens browser)
136-
// bmw login <user> <pass> → direct credentials
134+
// metal login --outofband → device code flow (no browser)
135+
// metal login → device code flow (opens browser)
136+
// metal login <user> <pass> → direct credentials
137137
bool outOfBand = args.Any(a => a == "--outofband");
138138
var filtered = args.Where(a => a != "--outofband").ToArray();
139139

@@ -254,7 +254,7 @@ static async Task<int> ListTypes()
254254
// --- list ---
255255
static async Task<int> ListEntities(string[] args)
256256
{
257-
if (args.Length < 1) return Help(1, "Usage: bmw list <type>");
257+
if (args.Length < 1) return Help(1, "Usage: metal list <type>");
258258
var slug = args[0];
259259
var resp = await _http.GetAsync($"/api/{slug}");
260260
if (!resp.IsSuccessStatusCode) { await PrintError(resp); return 1; }
@@ -267,7 +267,7 @@ static async Task<int> ListEntities(string[] args)
267267
// --- get ---
268268
static async Task<int> GetEntity(string[] args)
269269
{
270-
if (args.Length < 2) return Help(1, "Usage: bmw get <type> <id>");
270+
if (args.Length < 2) return Help(1, "Usage: metal get <type> <id>");
271271
var resp = await _http.GetAsync($"/api/{args[0]}/{args[1]}");
272272
if (!resp.IsSuccessStatusCode) { await PrintError(resp); return 1; }
273273
var body = await resp.Content.ReadAsStringAsync();
@@ -278,7 +278,7 @@ static async Task<int> GetEntity(string[] args)
278278
// --- create ---
279279
static async Task<int> CreateEntity(string[] args)
280280
{
281-
if (args.Length < 2) return Help(1, "Usage: bmw create <type> key=value [key=value...]");
281+
if (args.Length < 2) return Help(1, "Usage: metal create <type> key=value [key=value...]");
282282
var slug = args[0];
283283
var obj = ParseKeyValues(args[1..]);
284284
var json = JsonSerializer.Serialize(obj, BmwJsonContext.Default.DictionaryStringString);
@@ -294,7 +294,7 @@ static async Task<int> CreateEntity(string[] args)
294294
// --- update ---
295295
static async Task<int> UpdateEntity(string[] args)
296296
{
297-
if (args.Length < 3) return Help(1, "Usage: bmw update <type> <id> key=value [key=value...]");
297+
if (args.Length < 3) return Help(1, "Usage: metal update <type> <id> key=value [key=value...]");
298298
var slug = args[0]; var id = args[1];
299299
var obj = ParseKeyValues(args[2..]);
300300
var json = JsonSerializer.Serialize(obj, BmwJsonContext.Default.DictionaryStringString);
@@ -313,7 +313,7 @@ static async Task<int> UpdateEntity(string[] args)
313313
// --- delete ---
314314
static async Task<int> DeleteEntity(string[] args)
315315
{
316-
if (args.Length < 2) return Help(1, "Usage: bmw delete <type> <id>");
316+
if (args.Length < 2) return Help(1, "Usage: metal delete <type> <id>");
317317
var resp = await _http.DeleteAsync($"/api/{args[0]}/{args[1]}");
318318
if (!resp.IsSuccessStatusCode) { await PrintError(resp); return 1; }
319319
Console.WriteLine("Deleted.");
@@ -323,7 +323,7 @@ static async Task<int> DeleteEntity(string[] args)
323323
// --- query ---
324324
static async Task<int> QueryEntities(string[] args)
325325
{
326-
if (args.Length < 1) return Help(1, "Usage: bmw query <type> [field=X] [op=eq] [value=Y] [q=text] [sort=F] [dir=asc] [skip=0] [top=10]");
326+
if (args.Length < 1) return Help(1, "Usage: metal query <type> [field=X] [op=eq] [value=Y] [q=text] [sort=F] [dir=asc] [skip=0] [top=10]");
327327
var slug = args[0];
328328
var qs = new StringBuilder();
329329
for (int i = 1; i < args.Length; i++)
@@ -345,7 +345,7 @@ static async Task<int> QueryEntities(string[] args)
345345
// --- first ---
346346
static async Task<int> FirstEntity(string[] args)
347347
{
348-
if (args.Length < 1) return Help(1, "Usage: bmw first <type> [q=text] [field=X op=eq value=Y] [sort=F] [dir=asc|desc]");
348+
if (args.Length < 1) return Help(1, "Usage: metal first <type> [q=text] [field=X op=eq value=Y] [sort=F] [dir=asc|desc]");
349349
var slug = args[0];
350350
// Default sort by CreatedOnUtc desc (newest first), overridable
351351
var hasSort = args.Skip(1).Any(a => a.StartsWith("sort=", StringComparison.OrdinalIgnoreCase));
@@ -391,7 +391,7 @@ static int ShowConfig()
391391
static async Task<MetaEntity[]?> FetchMeta()
392392
{
393393
if (_meta != null) return _meta;
394-
if (string.IsNullOrEmpty(_config.Url)) { Console.Error.WriteLine("Not connected. Run: bmw connect <url>"); return null; }
394+
if (string.IsNullOrEmpty(_config.Url)) { Console.Error.WriteLine("Not connected. Run: metal connect <url>"); return null; }
395395
var resp = await _http.GetAsync("/api/_meta");
396396
if (!resp.IsSuccessStatusCode) { await PrintError(resp); return null; }
397397
var body = await resp.Content.ReadAsStringAsync();
@@ -556,20 +556,20 @@ static string ReadPassword()
556556

557557
static void PrintUsage()
558558
{
559-
Console.WriteLine("bmw - BareMetalWeb CLI");
559+
Console.WriteLine("metal - BareMetalWeb CLI");
560560
Console.WriteLine();
561-
Console.WriteLine("Usage: bmw <command> [args]");
561+
Console.WriteLine("Usage: metal <command> [args]");
562562
Console.WriteLine();
563-
Console.WriteLine("Run 'bmw help' for available commands.");
563+
Console.WriteLine("Run 'metal help' for available commands.");
564564
}
565565

566566
static int Help(int exitCode, string? error = null)
567567
{
568568
if (error != null) Console.Error.WriteLine($"Error: {error}\n");
569569
Console.WriteLine("""
570-
bmw - BareMetalWeb CLI
570+
metal - BareMetalWeb CLI
571571
572-
Usage: bmw <command> [args]
572+
Usage: metal <command> [args]
573573
574574
Connection:
575575
connect <url> [api-key] Set server URL and optional API key
@@ -593,14 +593,14 @@ types List available entity types
593593
first <type> [q=text] Get first matching entity (detail view)
594594
595595
Examples:
596-
bmw connect https://mysite.azurewebsites.net abc123key
597-
bmw types
598-
bmw list to-do
599-
bmw create to-do Title="Buy milk" Notes="From store"
600-
bmw query to-do q=milk sort=Deadline dir=asc top=5
601-
bmw get to-do abc123
602-
bmw update to-do abc123 IsCompleted=true
603-
bmw delete to-do abc123
596+
metal connect https://mysite.azurewebsites.net abc123key
597+
metal types
598+
metal list to-do
599+
metal create to-do Title="Buy milk" Notes="From store"
600+
metal query to-do q=milk sort=Deadline dir=asc top=5
601+
metal get to-do abc123
602+
metal update to-do abc123 IsCompleted=true
603+
metal delete to-do abc123
604604
""");
605605
return exitCode;
606606
}

0 commit comments

Comments
 (0)