Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 991 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 991 Revision 1663
Zeile 46... Zeile 46...
46
        $fullCommand = @realpath($fullCommand) ?: $fullCommand;
46
        $fullCommand = @realpath($fullCommand) ?: $fullCommand;
Zeile 47... Zeile 47...
47
 
47
 
48
        $shell = $this->guessShell();
48
        $shell = $this->guessShell();
49
        [$rcFile, $completionFile] = match ($shell) {
49
        [$rcFile, $completionFile] = match ($shell) {
50
            'fish' => ['~/.config/fish/config.fish', "/etc/fish/completions/$commandName.fish"],
50
            'fish' => ['~/.config/fish/config.fish', "/etc/fish/completions/$commandName.fish"],
51
            'zsh' => ['~/.zshrc', '$fpath[1]/'.$commandName],
51
            'zsh' => ['~/.zshrc', '$fpath[1]/_'.$commandName],
52
            default => ['~/.bashrc', "/etc/bash_completion.d/$commandName"],
52
            default => ['~/.bashrc', "/etc/bash_completion.d/$commandName"],
Zeile 53... Zeile 53...
53
        };
53
        };
Zeile 141... Zeile 141...
141
    /**
141
    /**
142
     * @return string[]
142
     * @return string[]
143
     */
143
     */
144
    private function getSupportedShells(): array
144
    private function getSupportedShells(): array
145
    {
145
    {
146
        return $this->supportedShells ??= array_map(function ($f) {
146
        if (isset($this->supportedShells)) {
147
            return pathinfo($f, \PATHINFO_EXTENSION);
147
            return $this->supportedShells;
-
 
148
        }
-
 
149
 
-
 
150
        $shells = [];
-
 
151
 
148
        }, glob(__DIR__.'/../Resources/completion.*'));
152
        foreach (new \DirectoryIterator(__DIR__.'/../Resources/') as $file) {
-
 
153
            if (str_starts_with($file->getBasename(), 'completion.') && $file->isFile()) {
-
 
154
                $shells[] = $file->getExtension();
-
 
155
            }
-
 
156
        }
-
 
157
        sort($shells);
-
 
158
 
-
 
159
        return $this->supportedShells = $shells;
149
    }
160
    }
150
}
161
}