Skip to content

Commit aef66ba

Browse files
SathishKumarHSpetermari
authored andcommitted
Initial commit
0 parents  commit aef66ba

File tree

3 files changed

+175
-0
lines changed

3 files changed

+175
-0
lines changed

LICENSE

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* Copyright (C) DevRev - All Rights Reserved
3+
*
4+
* The source and binary code in this repository are protected under international
5+
* copyright law. All rights reserved and protected by the copyright holders.
6+
*/

README.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# DevRev CLI
2+
3+
This repo provides the latest CLI release from DevRev. It is a tool that simplifies working
4+
with the DevRev REST API.
5+
6+
## Install with Debian Package
7+
8+
Supported architectures:
9+
10+
- linux amd64
11+
- linux arm64
12+
13+
Download the debian package from [https://github.com/devrev/cli/releases/latest](https://github.com/devrev/cli/releases/latest)
14+
and install it using the following command:
15+
16+
```bash
17+
sudo dpkg -i devrev_0.4.0-linux_amd64.deb
18+
```
19+
20+
or
21+
22+
```bash
23+
sudo dpkg -i devrev_0.4.0-linux_arm64.deb
24+
```
25+
26+
also run the below command to **install the completions**:
27+
28+
```bash
29+
wget https://raw.githubusercontent.com/devrev/cli/main/install_completions.sh && sh install_completions.sh /usr/local/bin/devrev
30+
```
31+
32+
Note: **/usr/local/bin/devrev** path may vary based on your debian installation
33+
34+
### Uninstall debian package
35+
36+
Use this command to deinstall the devrev debian package:
37+
38+
```bash
39+
sudo dpkg -r devrev
40+
```
41+
42+
## Installation with Homebrew
43+
44+
Homebrew installation supports the following architectures:
45+
46+
- darwin amd64
47+
- darwin arm64
48+
- linux arm64
49+
- linux amd64
50+
51+
Download the brew formula [devrev.rb](https://github.com/devrev/cli/releases/latest/download/devrev.rb) or run the below command:
52+
53+
```bash
54+
wget https://github.com/devrev/cli/releases/latest/download/devrev.rb
55+
```
56+
57+
Install the downloaded Homebrew formula file devrev.rb using below command:
58+
59+
```bash
60+
brew install ./devrev.rb
61+
```
62+
63+
also run the below command to **install the completions**:
64+
65+
```bash
66+
wget https://raw.githubusercontent.com/devrev/cli/main/install_completions.sh && sh install_completions.sh /opt/homebrew/bin/devrev
67+
```
68+
69+
Note: **/opt/homebrew/bin/devrev** path may vary based on your homebrew installation
70+
71+
### Uninstall devrev CLI
72+
73+
```bash
74+
brew uninstall devrev
75+
```
76+
77+
## Usage
78+
79+
The DevRev CLI provides several subcommands that can be used to perform various tasks. Here are some examples:
80+
81+
### CLI version
82+
83+
```bash
84+
devrev --version
85+
```
86+
87+
### Authentication to DevRev API
88+
89+
```bash
90+
devrev profiles authenticate --org <DevOrg-slug-name> --usr <[email protected]>
91+
```
92+
93+
**Arguments:**
94+
95+
`<DevOrg-slug-name>` : The unique slug name of your DevOrg to which you want to login.
96+
97+
`<[email protected]>` : Your registered user email for profile.
98+
99+
### CLI help
100+
101+
```bash
102+
devrev --help
103+
```
104+
105+
### License
106+
107+
DevRev CLI is proprietary software and is not open source. You may use it for your commercial use, but you may not distribute or modify it without our permission.
108+
109+
## Support
110+
111+
If you have any issues or questions about DevRev CLI, please contact our support team at [https://devrev.ai](https://devrev.ai)

install_completions.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/sh
2+
# A script for installing shell completions
3+
4+
set -e
5+
6+
shell_name="$(basename "$SHELL")"
7+
devrev_bin="$1"
8+
9+
if [ ! -f "$devrev_bin" ]; then
10+
echo "devrev executable not found, please pass the path as the first argument"
11+
exit 1
12+
fi
13+
14+
install_bash_completions() {
15+
completions_dir="${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}"/completions
16+
[ ! -d "$completions_dir" ] && mkdir -p "$completions_dir"
17+
"$devrev_bin" completion bash > "$completions_dir"/devrev
18+
}
19+
20+
install_zsh_completions() {
21+
if [ -d "$HOME"/.oh-my-zsh ]; then
22+
# If the user is using o-my-zsh, this is a natural place to put the completions
23+
completions_dir=$HOME/.oh-my-zsh/completions
24+
[ ! -d "$completions_dir" ] && mkdir -p "$completions_dir"
25+
"$devrev_bin" completion zsh > "$completions_dir"/_devrev
26+
else
27+
# Otherwise put it in our own directory, and add it to the fpath
28+
completions_dir=$HOME/.devrev/completions
29+
[ ! -d "$completions_dir" ] && mkdir -p "$completions_dir"
30+
"$devrev_bin" completion zsh > "$completions_dir"/_devrev
31+
32+
echo -e "fpath+=(""$completions_dir"")\n$(cat "$HOME"/.zshrc)" > "$HOME"/.zshrc
33+
printf "Completion script was installed in '%s'. We made an effort to add " \
34+
"this to the fpath in .zshrc, but you need to ensure that compinit is " \
35+
"run after it in the .zshrc" "$completions_dir"
36+
fi
37+
}
38+
39+
install_fish_completions() {
40+
completions_dir=$HOME/.config/fish/completions
41+
[ ! -d "$completions_dir" ] && mkdir -p "$completions_dir"
42+
"$devrev_bin" completion fish > "$completions_dir"/devrev.fish
43+
}
44+
45+
if [ "$shell_name" = "zsh" ]; then
46+
install_zsh_completions
47+
elif [ "$shell_name" = "bash" ]; then
48+
install_bash_completions
49+
elif [ "$shell_name" = "fish" ]; then
50+
install_fish_completions
51+
else
52+
printf "Shell '%s' has not been added to the script yet, generate " \
53+
"completions with 'devrev completion [shell_name]' and save the output to " \
54+
"wherever your shell reads them from, then create a new PR with your shell " \
55+
"added to the script" "$shell_name"
56+
fi
57+
58+
echo "Installed completions for $shell_name shell"

0 commit comments

Comments
 (0)