zsh selection input does not show in prompt - scripting

While using selection in a script, if I type '1' it does not show in the input.
Tab nor arrow keys highlight any of the choices.
I am using oh-my-zsh and I am on a M1 Mac(Monterey 12.6).
~ omz version
master (041c35f)
Script:
echo "$sig Choose ENVIRONMENT (defaul-qa):"
declare -a envList
envList=(qa dev int prod)
serviceEnv="qa"
select var in "${envList[#]}"; do
serviceEnv=$var
echo "$var"
break
done
This is what it looks like in the terminal:
➜ .oh-my-zsh git:(master) ✗ restartService
~~^~~ Enter a service name: testService
~~^~~ Choose ENVIRONMENT (defaul-qa):
1) qa
2) dev
3) int
4) prod
?#
qa
Any help is appreciated.
Ive tried to find if other users had the same issue but could not find anything online.

Related

Cygwin ssh not setting DISPLAY correctly (extra :0)

I am using Cygwin on Windows 7 to connect to a unix (RHEL 6) server via SSH. When I do so, X forwarding is not being set correctly:
(Starting from Cygwin xterm on the Windows machine)
> echo $DISPLAY
:0
> ssh -Y myname#rhel.server.com
[enter password]
> echo $DISPLAY
localhost:52.0:0
If I now try to start any windowed process, I get an error message:
> emacs
emacs: Cannot connect to X server localhost:52.0:0.
Check the DISPLAY environment variable or use '-d'.
Also use the 'xhost' program to verify that it is set to permit connections from your machine.
Additional Details
The number that follows 'localhost' (52 in the example above) is different each time I connect.
If I do the following,
> export DISPLAY=localhost:52.0
(that is, I remove the trailing ":0) then this DOES fix the issue, and the window forwarding works just fine.
So the question is: how to fix so that I do not need to manually change the DISPLAY variable with each connection?
A false alarm, much to my embarrassment. Turns out my .profile (that I had borrowed from someone else, as it contained a large quantity of useful customization for our development environment) contained these lines:
export DISPLAY
if [[ -z $DISPLAY ]]; then
DISPLAY=my.machine.addr:0
elif echo $DISPLAY | grep -z -v ':0'; then
DISPLAY=$DISPLAY:0
fi
Lo and behold, commenting out the elif branch solves the problem. May this be a lesson to us all on the dangers of copying someone else's config without knowing what it contains.

zsh alias not recognizing : command not found

Hellor everybody, i wanted to add an alias in my .zshrc file but please have a look at this i really don't understand
[23:29:36] charvet:~ $ expressvpn
NAME:
expressvpn - ExpressVPN command line interface
USAGE:
expressvpn command [arguments...]
VERSION:
1.1.0 (e822d60)
COMMANDS:
activate Activate account
connect Connect to VPN
disconnect Disconnect from VPN
status Display service information
list, ls List VPN locations
autoconnect Enable / disable auto-connect
protocol Display / change preferred protocol
refresh Refresh VPN clusters
reset Reset VPN account
diagnostics Display connection diagnostics
preferences List user preferences
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
Then i wrote in my file .zshrc
alias expressvpn=vpn
Then in zsh :
[23:29:46] charvet:~ $ source .zshrc
ls='ls --color=tty'
[23:29:52] charvet:~ $ vpn
zsh: command not found: vpn
[23:29:55] charvet:~ $
I am completely lost, i don't understand. People talk about the white space around the "=" but i haven't any.
Try alias vpn=expressvpn?
Try help alias for help with alias syntax.
You have to say in your profile
alias expressvpn= 'vpn'
that's how it works

Creating a TravisCI config for automated testing of a Go application

I would like to create a .travis.yml config that performes the following:
fetches a Go application source code from Github,
installs the other required libraries with go get
attempts to build the go application with go build
run tests with go test
I new to Go application testing with TravisCI, therefore I would appreciate any help or examples someone could point me to.
Add a .travis.yml to the root of your repository;
Connect your GitHub account to TravisCI
Flick the switch to run builds on commits and pull requests.
Here's what I'm using for some of the Gorilla toolkit repos:
language: go
sudo: false
matrix:
include:
- go: 1.2
- go: 1.3
- go: 1.4
- go: 1.5
- go: 1.6
- go: tip
install:
- go get golang.org/x/tools/cmd/vet
script:
- go get -t -v ./...
- diff -u <(echo -n) <(gofmt -d .)
- go tool vet .
- go test -v -race ./...
(source: https://github.com/gorilla/csrf/blob/master/.travis.yml)

How to start a Rails server with an .sh script in a directory of choice

I've been developing with rails for a year now, and although rails is pretty well automated, I'd like to take it one step further.
Every time i start working on a project, i open the terminal, cd to a project folder, than new tab in the terminal, then start the server with "rails s" then back to the first tab to run "sublime ." so that i load the folder in my text editor, Sublime Text.
What i would like is to create a .sh script that would do all that for me, but so far i haven't been able to make it start the server.
So, how to start rails server with a .sh script in a directory of choice?
#Manolo gave me an idea, so I've come up with this:
I modified my .bashrc as the following answer illustrates:
https://superuser.com/a/198022
Basically i added
eval "$BASH_POST_RC"
At the end of my .bashrc so i could run arbitrary commands after it was executed.
Next, i made a following script:
#launch_project.sh
#/bin/bash
cd <PROJECT DIR GOES HERE>;
firefox -P "development";
sublime . &;
gnome-terminal \
--tab --title="Server" -e 'bash -c "export BASH_POST_RC=\"rails s\";exec bash"' \
--tab -e 'bash -c "export BASH_POST_RC=\"git s\"; exec bash"';
That launches my development profile on firefox, my editor with a project root, and terminal window with two tabs - one that runs a WEBrick server, and another one which runs git status for me.
I made a desktop shortcut to the script so i have my own custom IDE of sorts :)
Try this:
#!/bin/sh
cd your_project_folder
nohup rails s > /tmp/rails_server.log 2>&1 &
sublime .
you can see the ouput of your rails server at the /tmp/rails_server.log file

Install all modules at once in OpenERP?

How to install all modules in OpenERP at once? At single click it install all modules.
If you use a 7.0 then a good news for you.
-> Go to setting ,click on modules and go to list view of modules.
->Search module that are Not Installed by click on search box.
->click on limit on top right (1-80 of 156) and select unlimited.
->check top left check box that can check all the check box of all module in list view.
-> Now click on more button and then click Module Immediate installed.
-> be Patience this will take some time to installed all module but it surly installed all modules.
Well Pinakin,
Their can be may ways that you can prefer rather being ironic, You have one option as Heroic or you can also use some external shell script which will one go run.
The code can look like this. Save this is Shell script under server folder.
#line to drop some existing db if we have any, You can skip this.
psql -l | grep somedb_name |cut -d \| -f1 | xargs -n1 dropdb
# Create new Db
createdb somedb_name --encoding=Unicode
# install base module. and Stop the server
./openerp-server --addons-path=../../addons/trunk,../../web/trunk/addons/ -d somedb_name --stop-after-init -i base
#Now trigger sql and marke all module to install with demo true.
psql somedb_name -c "UPDATE ir_module_module SET state = 'to install', demo = true ;"
#againstart Server and let all module get insalled and then server will keep running foreve you want.
./openerp-server --addons-path=../../addons/trunk,../../web/trunk/addons/ -u base -d somedb_name
You may Need to chage the some path depending on your code managment on dir.
While starting the server you can add parameter in the server path like
./openerp-server --addons ../addons/,
../openerp-web/addons/ -i <list of modules> -d <database name>
give list of module name separated by comma, it will install in the module in the given database.