File size: 594 Bytes
89a2873
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { EOL } from "os"
import { Option } from "effect"
import * as Effect from "effect/Effect"
import { Commands } from "../../commands"
import { Runtime } from "../../../framework/runtime"
import { Daemon } from "../../../services/daemon"

export default Runtime.handler(
  Commands.commands.service.commands.password,
  Effect.fn("cli.service.password")(function* (input) {
    const daemon = yield* Daemon.Service
    const value = Option.getOrUndefined(input.value)
    if (value !== undefined) yield* daemon.stop()
    process.stdout.write((yield* daemon.password(value)) + EOL)
  }),
)