summaryrefslogtreecommitdiff
path: root/internal/askcli/command_fish.go
blob: 89a84577876bf028c7cb6fcb34a2cdc2ba5cf0e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package askcli

import (
	"fmt"
	"io"
	"os"
)

func (d Dispatcher) handleFish(args []string, stdout, stderr io.Writer) (int, error) {
	if len(args) != 1 {
		fmt.Fprintln(stderr, "usage: ask fish")
		return 1, nil
	}
	binaryPath, err := os.Executable()
	if err != nil {
		binaryPath = "ask"
	}
	if _, err := io.WriteString(stdout, FishCompletionFor(binaryPath)); err != nil {
		return 1, err
	}
	return 0, nil
}