Skip to content

Commit

Permalink
feat: add ghcs and ghce abbrs
Browse files Browse the repository at this point in the history
  • Loading branch information
Asim-Tahir committed Dec 20, 2024
0 parents commit 6eba57b
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

charset = utf-8
end_of_line = lf
tab_width = 1
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2025 Asim Tahir

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<img src="https://cdn.rawgit.com/oh-my-fish/oh-my-fish/e4f1c2e0219a17e2c748b824004c8d0b38055c16/docs/logo.svg" align="left" width="192px" height="192px"/>
<img align="left" width="0" height="192px" hspace="10"/>

### `github-copilot-cli.fish`

> `GitHub Copilot CLI` plugin for [Oh My Fish][omf] and [Fisher][fisher],
[![MIT License](https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square)](/LICENSE)
[![Fish Shell v3.6.0](https://img.shields.io/badge/fish-v3.6.0-007EC7.svg?style=flat-square)](https://fishshell.com)
[![Oh My Fish Framework](https://img.shields.io/badge/Oh%20My%20Fish-Framework-007EC7.svg?style=flat-square)][omf]

<br/>

## Prerequisites

- [GitHub CLI](https://cli.github.com/) installed and authenticated.
- [GitHub Copilot CLI extension](https://docs.github.com/en/copilot/managing-copilot/configure-personal-settings/installing-github-copilot-in-the-cli) installed.

## Install

[Oh My Fish][omf]:

```fish
omf install https://github.com/Asim-Tahir/github-copilot-cli.fish
```

[Fisher][fisher]:

```fish
fisher install Asim-Tahir/github-copilot-cli.fish
```

## Abbreviations Usage

After installing the [`github-copilot-cli.fish`][repo] plugin, can inspect the abbreviations with the following command:

```fish
abbr --show | grep ghcs
```

| Abbreviation | Command |
| ------------ | -------------------- |
| `ghcs` | `gh copilot suggest` |
| `ghce` | `gh copilot explain` |

# Credit

Base structure heavily inspired from [`jhillyerd/plugin-git`](https://github.com/jhillyerd/plugin-git). Thanks for the amazing plugin.

# License

[MIT][license] © [Asim Tahir][author]

[author]: https://github.com/Asim-Tahir
[repo]: https://github.com/Asim-Tahir/github-copilot-cli.fish
[license]: https://opensource.org/licenses/MIT
[omf]: https://github.com/oh-my-fish/oh-my-fish
[fisher]: https://github.com/jorgebucaran/fisher
[license-badge]: https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square
7 changes: 7 additions & 0 deletions conf.d/github-copilot-cli.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Fisher initialization
# protected as omf also tries to run it.
set -q fisher_path; or set -l fisher_path $__fish_config_dir
if test -f $fisher_path/functions/_github-copilot-cli.init.fish
source $fisher_path/functions/_github-copilot-cli.init.fish
_github-copilot-cli.init
end
4 changes: 4 additions & 0 deletions functions/_github-copilot-cli.abbrs.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function _github-copilot-cli.abbrs -d "Initialize GitHub Copilot Command Line Interface(CLI) abbreviations"
abbr -a -g ghcs gh copilot suggest
abbr -a -g ghce gh copilot explain
end
4 changes: 4 additions & 0 deletions functions/_github-copilot-cli.init.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function _github-copilot-cli.init -d "Initialize GitHub Copilot Command Line Interface(CLI) plugin"
# Initialize GitHub Copilot CLI abbreviations
_github-copilot-cli.abbrs
end
10 changes: 10 additions & 0 deletions init.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Oh My Fish initialization
# $path is only defined for oh-my-fish. home-manager activates this plugin by
# adding the full path of functions/ to fish_function_path, and then sourcing
# init.fish, so let's skip sourcing _github-copilot-cli.init.fish before calling _github-copilot-cli.init.
set -l _github_copilot_cli_init_path "$path/functions/_github-copilot-cli.init.fish"
if [ -f "$_github_copilot_cli_init_path" ];
source "$_github_copilot_cli_init_path"
end

_github-copilot-cli.init

0 comments on commit 6eba57b

Please sign in to comment.