Code Monkey home page Code Monkey logo

spot's Introduction

spot(1)

Tiny ack-style file search utility.

Features

  • Short & written in Bash: you can edit it easily to suit your liking.
  • Fast. Just find + grep + awk.
  • Searches most things by default instead of some known predefined extensions.
  • Ignores .git, .hg, .svn, devices and binary files.

Usage

Smart phrases

All arguments constitute the search text. No need to wrap most searches in double quotes.

Smart case

spot is case-insensitive by default. However, if your search term contains an uppercase letter, it becomes sensitive!

Smart targets

If the first argument contains a slash and is a valid directory, the search is constrained to that particular target.

Wildcard matching

In spot(1) searches, the . character acts as the RegExp wildcard, making it very easy to perform searches that match anything, and to avoid escaping characters or including ones that are not necessary for your search.

Line abbreviation

If the line where matches are found is too long (such as minified source files), spot(1) will only display the surrounding characters.

Options

spot -h to see them.

Installation

If you have NPM:

$ npm install -g spot

Or if you have bpkg

$ bpkg install -g spot

You're done! Otherwise, run this command:

curl -L https://raw.github.com/rauchg/spot/master/spot.sh -o ~/bin/spot && chmod +x ~/bin/spot

If you don't have ~/bin, replace it with another directory in your $PATH, like /usr/local/bin.

License

(The MIT License)

Copyright (c) 2014 Guillermo Rauch <[email protected]>

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.

spot's People

Contributors

alphapapa avatar bobbor avatar bryson avatar denilsonsa avatar fizerkhan avatar joshdick avatar jwerle avatar kant avatar rauchg avatar tj avatar xaekai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spot's Issues

shellcheck reports multiple warnings for spot.sh

Hi, thanks for writing this! I'm trying to package the script for Debian and was advised to run shellcheck (http://hackage.haskell.org/package/ShellCheck) on the script before going further. It reports some thngs that you might want to fix.

In spot.sh line 31:
cyan=`echo -e '\033[96m'`
     ^-- SC2006: Use $(..) instead of deprecated `..`


In spot.sh line 32:
reset=`echo -e '\033[39m'`
      ^-- SC2006: Use $(..) instead of deprecated `..`


In spot.sh line 115:
    dir=`echo $1 | sed "s/\/$//"`
        ^-- SC2006: Use $(..) instead of deprecated `..`
         ^-- SC2001: See if you can use ${variable//search/replace} instead.
              ^-- SC2086: Double quote to prevent globbing and word splitting.


In spot.sh line 155:
if [ $filename ]; then
     ^-- SC2086: Double quote to prevent globbing and word splitting.


In spot.sh line 160:
eval "find "$dir" $findopt -type f $exclude -print0" \
            ^-- SC2027: The surrounding quotes actually unquote this. Remove or escape them.
            ^-- SC2086: Double quote to prevent globbing and word splitting.


In spot.sh line 161:
  | GREP_COLOR="1;33;40" xargs -0 grep $grepopt -e "`echo $@`" \
                                       ^-- SC2086: Double quote to prevent globbing and word splitting.
                                                    ^-- SC2116: Useless echo? Instead of 'cmd $(echo foo)', just use 'cmd foo'.
                                                    ^-- SC2006: Use $(..) instead of deprecated `..`
                                                          ^-- SC2068: Double quote array expansions, otherwise they're like $* and break on spaces.


In spot.sh line 165:
  | awk -v linenums=$linenums -v reset=`tput sgr0` -v colors=$colors -v mline=$mline '{
                                       ^-- SC2046: Quote this to prevent word splitting.
                                       ^-- SC2006: Use $(..) instead of deprecated `..`

As you can see it's rather minor things, but there are some quoting warnings that might cause problems in the future. I'll submit a pull request when I get some time, hope you can begin fixing this in the meantime! By the way, the request for packaging is at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688866 and any help is welcome.

Thanks again

Curl command gives an error during installation

Using the provided CURL instruction renders an error for me... (OS X 10.7.4). Same result with sudo or without sudo.

May I suggest making a Homebrew package for this?

sudo curl https://raw.github.com/guille/spot/master/spot.sh -o ~/usr/local/bin/spot && chmod +x ~/usr/local/bin/spot

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /Users/hced/usr/local/bin/spot: No such 
Warning: file or directory
100  2519  100  2519    0     0   2172      0  0:00:01  0:00:01 --:--:--  4403
curl: (23) Failed writing body (0 != 2519)
hced@hced ~ % which curl && curl --version

/usr/bin/curl
curl 7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp 
Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM SSL libz

Ignore *~ and other files?

Would be nice if it didn't search in *~ files and .*.swp files (and any other temporary/backup files). I'll send a pull request if I have time.

Spot not working

I installed via the curl option.
When I run spot something:

root@server:# spot 8088

root@server# 

It justs returns a new line and stops (instantly)
I can run spot -h and everything perfectly.
When trying spot --update

root@server# spot --update
... updating
Cloning into 'spot'...
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 9 (delta 0), reused 5 (delta 0), pack-reused 0
Receiving objects: 100% (9/9), 4.80 KiB | 0 bytes/s, done.
Checking connectivity... done.
cp spot.sh /usr/local/bin/spot
cp spot.1 /usr/local/share/man/man1/spot.1
cp: cannot create regular file '/usr/local/share/man/man1/spot.1': No such file or directory
Makefile:12: recipe for target 'install' failed
make: *** [install] Error 1

This is on ubuntu server 16.04.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.