Skip to content

Commit

Permalink
chore: add CLI autocomplete to makefile (osmosis-labs#6012)
Browse files Browse the repository at this point in the history
* add autocomplete to make file

* make bash the shell for makefile in place of sh

* changes

* add line

* remove parent shell print

* proper spacing

* update changelog

* update changelog

---------

Co-authored-by: devbot-wizard <[email protected]>
  • Loading branch information
czarcas7ic and devbot-wizard authored Aug 11, 2023
1 parent 396e722 commit 708ee2e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 6 deletions.
13 changes: 7 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [#5534](https://github.com/osmosis-labs/osmosis/pull/5534) fix: fix the account number of x/tokenfactory module account
* [#5750](https://github.com/osmosis-labs/osmosis/pull/5750) feat: add cli commmand for converting proto structs to proto marshalled bytes
* [#5889](https://github.com/osmosis-labs/osmosis/pull/5889) provides an API for protorev to determine max amountIn that can be swapped based on max ticks willing to be traversed
* [#5849] (https://github.com/osmosis-labs/osmosis/pull/5849) CL: Lower gas for leaving a position and withdrawing rewards
* [#5849](https://github.com/osmosis-labs/osmosis/pull/5849) CL: Lower gas for leaving a position and withdrawing rewards
* [#5855](https://github.com/osmosis-labs/osmosis/pull/5855) feat(x/cosmwasmpool): Sending token_in_max_amount to the contract before running contract msg
* [#5893] (https://github.com/osmosis-labs/osmosis/pull/5893) Export createPosition method in CL so other modules can use it in testing
* [#5870] (https://github.com/osmosis-labs/osmosis/pull/5870) Remove v14/ separator in protorev rest endpoints
* [#5923] (https://github.com/osmosis-labs/osmosis/pull/5923) CL: Lower gas for initializing ticks
* [#5927] (https://github.com/osmosis-labs/osmosis/pull/5927) Add gas metering to x/tokenfactory trackBeforeSend hook
* [#5893](https://github.com/osmosis-labs/osmosis/pull/5893) Export createPosition method in CL so other modules can use it in testing
* [#5870](https://github.com/osmosis-labs/osmosis/pull/5870) Remove v14/ separator in protorev rest endpoints
* [#5923](https://github.com/osmosis-labs/osmosis/pull/5923) CL: Lower gas for initializing ticks
* [#5927](https://github.com/osmosis-labs/osmosis/pull/5927) Add gas metering to x/tokenfactory trackBeforeSend hook
* [#5890](https://github.com/osmosis-labs/osmosis/pull/5890) feat: CreateCLPool & LinkCFMMtoCL pool into one gov-prop
* [#5959](https://github.com/osmosis-labs/osmosis/pull/5959) allow testing with different chain-id's in E2E testing
* [#5964](https://github.com/osmosis-labs/osmosis/pull/5964) fix e2e test concurrency bugs
* [#5948] (https://github.com/osmosis-labs/osmosis/pull/5948) Parameterizing Pool Type Information in Protorev
* [#5948](https://github.com/osmosis-labs/osmosis/pull/5948) Parameterizing Pool Type Information in Protorev
* [#6001](https://github.com/osmosis-labs/osmosis/pull/6001) feat: improve set-env CLI cmd
* [#6012](https://github.com/osmosis-labs/osmosis/pull/6012) chore: add autocomplete to makefile

### Minor improvements & Bug Fixes

Expand Down
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
BUILDDIR ?= $(CURDIR)/build
DOCKER := $(shell which docker)
E2E_UPGRADE_VERSION := "v17"
SHELL := /bin/bash

GO_VERSION := $(shell cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2)
GO_MODULE := $(shell cat go.mod | grep "module " | cut -d ' ' -f 2)
Expand Down Expand Up @@ -119,6 +120,41 @@ build-all: check_version go.sum
install: check_version go.sum
GOWORK=off go install -mod=readonly $(BUILD_FLAGS) $(GO_MODULE)/cmd/osmosisd

install-with-autocomplete: check_version go.sum
GOWORK=off go install -mod=readonly $(BUILD_FLAGS) $(GO_MODULE)/cmd/osmosisd
@PARENT_SHELL=$$(ps -o ppid= -p $$PPID | xargs ps -o comm= -p); \
if [[ "$$PARENT_SHELL" == *zsh* ]]; then \
if ! grep -q ". <(osmosisd enable-cli-autocomplete zsh)" ~/.zshrc; then \
echo ". <(osmosisd enable-cli-autocomplete zsh)" >> ~/.zshrc; \
source ~/.zshrc; \
else \
echo "Autocomplete already enabled in ~/.zshrc"; \
fi \
elif [[ "$$PARENT_SHELL" == *bash* && "$$(uname)" == "Darwin" ]]; then \
if ! grep -q -e "\. <(osmosisd enable-cli-autocomplete bash)" -e '\[\[ -r "/opt/homebrew/etc/profile.d/bash_completion.sh" \]\] && \. "/opt/homebrew/etc/profile.d/bash_completion.sh"' ~/.bashrc; then \
brew install bash-completion; \
echo '[[ -r "/opt/homebrew/etc/profile.d/bash_completion.sh" ]] && . "/opt/homebrew/etc/profile.d/bash_completion.sh"' >> ~/.bashrc; \
echo ". <(osmosisd enable-cli-autocomplete bash)" >> ~/.bashrc; \
echo; \
echo "Autocomplete enabled. Run 'source ~/.bashrc' to complete installation."; \
else \
echo "Autocomplete already enabled in ~/.bashrc"; \
fi \
elif [[ "$$PARENT_SHELL" == *bash* && "$$(uname)" == "Linux" ]]; then \
if ! grep -q ". <(osmosisd enable-cli-autocomplete bash)" ~/.bashrc; then \
sudo apt-get install -y bash-completion; \
echo '[[ -r "/etc/bash_completion" ]] && . "/etc/bash_completion"' >> ~/.bashrc; \
echo ". <(osmosisd enable-cli-autocomplete bash)" >> ~/.bashrc; \
echo; \
echo "Autocomplete enabled. Run 'source ~/.bashrc' to complete installation."; \
else \
echo "Autocomplete already enabled in ~/.bashrc"; \
fi \
else \
echo "Shell or OS not recognized. Skipping autocomplete setup."; \
fi


# Cross-building for arm64 from amd64 (or viceversa) takes
# a lot of time due to QEMU virtualization but it's the only way (afaik)
# to get a statically linked binary with CosmWasm
Expand Down

0 comments on commit 708ee2e

Please sign in to comment.