v0.34.0 doc sweep and update
This commit is contained in:
1 parent
87f5576ccf
commit
1abffcec6c
41 files changed
+1447
-2287
No files matched your search
+1
-1
@@ -198,7 +198,7 @@ func parseCommandLine(argv []string) (inv invocation, err error) {
|
||||
}
|
||||
specFlags, settings := config.SpecFlags(), config.Settings()
|
||||
unexpected := func(word string) error {
|
||||
return fmt.Errorf("unexpected argument %q: lw takes options only (a configuration file is -c FILE, a switch's value follows '=')", word)
|
||||
return fmt.Errorf("unexpected argument %q: lw takes options only (a configuration file is -c FILE, a boolean key's value follows '=')", word)
|
||||
}
|
||||
next := func(i *int) string {
|
||||
if *i+1 < len(argv) && !strings.HasPrefix(argv[*i+1], "-") {
|
||||
|
||||
+7
-5
@@ -26,8 +26,9 @@ Usage:
|
||||
Commands (lw COMMAND -h lists its subcommands):
|
||||
%s
|
||||
Options: a short option is its long one; a value follows as the next argument
|
||||
or after '=' (-c FILE, --config=FILE), one that starts with '-' or a switch's
|
||||
after '='; short options do not combine. lw takes options only.
|
||||
or after '=' (-c FILE, --config=FILE), one starting with '-' after '='; a
|
||||
BOOL key's only after '=', and -t, --dump, -T, -V, --schema take none.
|
||||
Short options do not combine. lw takes options only.
|
||||
-c, --config FILE Configuration file (default:
|
||||
~/.config/logwisp/logwisp.toml if it exists,
|
||||
else ./logwisp.toml)
|
||||
@@ -82,9 +83,10 @@ key alone means true:
|
||||
|
||||
Pipelines (they replace the configuration file's pipelines):
|
||||
-p, --preset NAME[:KEY=VALUE,...]
|
||||
Start a pipeline with a preset: pipe, tail,
|
||||
serve, edge, aggregator; lw preset NAME -h
|
||||
lists its keys, lw preset NAME prints it
|
||||
Begin a pipeline with a preset (a second
|
||||
needs its own --pipeline): pipe, tail, serve,
|
||||
edge, aggregator; lw preset NAME -h lists
|
||||
its keys, lw preset NAME prints it
|
||||
--pipeline NAME Start a pipeline named NAME, which the
|
||||
pipeline options after it configure; those
|
||||
before any --pipeline make one named after
|
||||
|
||||
+4
-15
@@ -39,26 +39,15 @@ func TestWatchErrorsDoNotTriggerReloadAndChangesAreCoalesced(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestShippedConfigurationBuildsWithCheckedPluginDecoder(t *testing.T) {
|
||||
testLogger(t)
|
||||
// The shipped file defines no pipeline, so lw keeps its built-in pipe
|
||||
func TestShippedConfigurationKeepsTheBuiltInPipeline(t *testing.T) {
|
||||
path, err := filepath.Abs(filepath.Join("..", "..", "config", "logwisp.toml"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cfg := loadTestConfig(t, path)
|
||||
if len(cfg.Pipelines) != 1 || cfg.Pipelines[0].Name != "default" {
|
||||
t.Fatalf("sample array-of-tables decoded incorrectly: %+v", cfg.Pipelines)
|
||||
if cfg := loadTestConfig(t, path); len(cfg.Pipelines) != 1 || cfg.Pipelines[0].Name != "pipe" {
|
||||
t.Fatalf("the sample defines pipelines: %+v", cfg.Pipelines)
|
||||
}
|
||||
svc, err := bootstrapService(context.Background(), cfg, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer svc.Shutdown()
|
||||
pl, err := svc.GetPipeline("default")
|
||||
if err != nil || len(pl.Sources) != 1 || len(pl.Sinks) != 1 {
|
||||
t.Fatalf("sample plugins failed to build: %v", err)
|
||||
}
|
||||
svc.Shutdown() // A later reload failure or process exit can close it again.
|
||||
}
|
||||
|
||||
// Once the first service is built a reload reads no descriptor, pipe or
|
||||
|
||||
@@ -55,7 +55,7 @@ export function fields(schema, role, type) {
|
||||
const rows = (keys, prefix) => keys.map(key => {
|
||||
const path = prefix + key.key;
|
||||
if (Array.isArray(key.keys)) return { path, key, rows: rows(key.keys, path + ".") };
|
||||
return { path, key, placeholder: key.zero ? `(${key.zero})` : (key.default ?? key.hint ?? "") };
|
||||
return { path, key, placeholder: key.default ?? (key.zero ? `(${key.zero})` : (key.hint ?? "")) };
|
||||
});
|
||||
return rows(plugin?.keys ?? schema.flow.find(s => s.key === role)?.keys ?? [], "");
|
||||
}
|
||||
|
||||
@@ -152,6 +152,7 @@ test("fields are a node's keys, its tables' of the plugin's side as groups", ()
|
||||
assert.deepEqual(rows.find(r => r.path === "port").key.max, 65535);
|
||||
assert.equal(fields(schema, "rate_limit").find(r => r.path === "entries_per_second").placeholder, "(off)");
|
||||
assert.equal(fields(schema, "heartbeat").find(r => r.path === "interval_ms").placeholder, "1000");
|
||||
assert.equal(fields(schema, "sink", "file").find(r => r.path === "retention_hours").placeholder, "168");
|
||||
});
|
||||
|
||||
test("a refused call answers why and where, and the engine keeps answering", () => {
|
||||
|
||||
Reference in new issue
Block a user