trefoil-cli 0.4.0__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trefoil-cli
3
- Version: 0.4.0
3
+ Version: 0.6.0
4
4
  Summary: CLI for the trefoil agent server
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: pyyaml>=6
@@ -15,7 +15,7 @@ Usage: trefoil <domain> <command> [args]
15
15
 
16
16
  trefoil init [DIR] [--example=NAME]
17
17
  trefoil update
18
- trefoil engine start [--settings=backend.yml] [--port=8080] [-d]
18
+ trefoil engine start [--settings=backend.yml] [--port=8080] [--foreground]
19
19
  trefoil engine stop
20
20
  trefoil config package path/to/config.yml [-o bundle.json]
21
21
  trefoil config sync [path/to/config.yml] [--server URL]
@@ -224,11 +224,15 @@ def cmd_engine_start(args):
224
224
  sys.exit(f"trefoil: env_file {host} (from {args.settings}) not found")
225
225
  target = env_file if os.path.isabs(env_file) else os.path.normpath(f"/trefoil/settings/{env_file}")
226
226
  cmd += ["-v", f"{host}:{target}:ro"]
227
- if args.detach:
227
+ if not args.foreground:
228
228
  cmd.append("-d")
229
229
  cmd.append(args.image)
230
230
  print(f"trefoil: {' '.join(cmd)}", file=sys.stderr)
231
- sys.exit(subprocess.run(cmd).returncode)
231
+ code = subprocess.run(cmd, stdout=subprocess.DEVNULL if not args.foreground else None).returncode
232
+ if code == 0 and not args.foreground:
233
+ print(f"trefoil: engine running on http://localhost:{args.port} "
234
+ f"(logs: docker logs -f {args.name}, stop: trefoil engine stop)", file=sys.stderr)
235
+ sys.exit(code)
232
236
 
233
237
 
234
238
  def cmd_engine_stop(args):
@@ -585,7 +589,8 @@ def main():
585
589
  engine_start.add_argument("--name", default="trefoil-api", help="container name (default: trefoil-api)")
586
590
  engine_start.add_argument("--volume", default="trefoil-data",
587
591
  help="docker volume (or host path) for the data dir (default: trefoil-data)")
588
- engine_start.add_argument("-d", "--detach", action="store_true", help="run in the background")
592
+ engine_start.add_argument("--foreground", action="store_true",
593
+ help="run attached instead of in the background")
589
594
  engine_start.set_defaults(func=cmd_engine_start)
590
595
  engine_stop = engine.add_parser("stop", help="stop the running API server container")
591
596
  engine_stop.add_argument("--name", default="trefoil-api", help="container name (default: trefoil-api)")
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "trefoil-cli"
3
- version = "0.4.0"
3
+ version = "0.6.0"
4
4
  description = "CLI for the trefoil agent server"
5
5
  requires-python = ">=3.10"
6
6
  dependencies = ["pyyaml>=6"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trefoil-cli
3
- Version: 0.4.0
3
+ Version: 0.6.0
4
4
  Summary: CLI for the trefoil agent server
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: pyyaml>=6
File without changes