-
Notifications
You must be signed in to change notification settings - Fork 13
Multiple code repo search #12
Comments
@suntong , does the already available |
Not quite, in the sense of usability. Consider the following:
and
I think most people would agree that the first approach is more user friendly. The |
I wrote the response below but realized you are on windows so this doesn't work for you. But here it is anyway for unix folks. I don't use the project model that a lot of people seem to use. There are two options that can solve your requirement easily.
% cat ~/.config/projects
myproj1=/the/crazy/path/I/need/to/set/in/order/to/get/to/index/.myproj2
theirproject2=/some/other/entirely/different/location/altogether
% cat csproj
#!/bin/sh
name="$1"
shift
source ~/.config/projects
csearch -indexpath "$name" "$@"
% csproj myproj2 regexp
#!/usr/bin/env bash
findup() {
local what thisdir
what="$1"
[ -z "$what" ] && return 1
thisdir="$(pwd)" || return 1
cd "$thisdir" || return 1
thisdir="$(pwd)" || return 1
while [ -n "$thisdir" ]; do
if [ -e "$thisdir/$what" ] || [ -L "$thisdir/$what" ]; then
echo "$thisdir/$what"
return 0
fi
[ "$thisdir" = "/" ] && return 1
thisdir="$(/usr/bin/dirname "$thisdir")" || return 1
done
return 1
}
if [ -n "$GOPATH" ]; then
echo "$GOPATH" | sed -e 's/:/\
/g' | while read -r line ; do
eval "PATH=\"\$line/bin:\$PATH\""
done
else
GOPATH="$HOME/work/go"
PATH="$HOME/work/go/bin:$PATH"
fi
PATH="$HOME/bin:$PATH"
PATH=$PATH:$HOME/bin:$HOME/work/go/bin
export PATH
export GOPATH
[[ ! -e .csearchindex && ! -h .csearchindex ]] && echo ".csearchindex file is not present in current directory." >&2
deepest="$(findup .csearchindex)"
if [ -n "$deepest" ]; then
/usr/bin/env "CSEARCHINDEX=$deepest" csearch -f "$(pwd)" "$@"
else
csearch -f "$(pwd)" "$@"
fi |
Thanks for the code. Yeah I need codesearch on windows only. Under Linux I use glimpse, which "uses a very small index – in most cases 2-4% of the size of the text", and it is super easy to break into different indexes. So again, on windows, since none of above is available, adding the feature to codesearch seems more desirable. I can do it myself, since the |
Patches are always welcome but when adding new options I need to evaluate many things. In this case, mainly:
Unfortunately, my time is limited due to a busy day job so not sure when I can participate more than casually in such discussions/development. But it's open source so you can modify it as you please even if I can't find time. Using the Makefile you can do cross platform builds and get Windows binaries easily. |
This issue was moved to junkblocker/codesearch#5 |
Expanding on the idea from #9, I think the best solution is to separate different code repo into different indexes, because after all, developers working on a single project is rather rare -- I personally need to do code search on many different code repos.
I propose just adding a
-name
to both index and search program, to separate different indexes.Further, it's not only apply to different code repo, but even within the same repo, you can use
-name
to divide them into logical groups whatever you like, if you find eliminating a section is constantly needed.The text was updated successfully, but these errors were encountered: