Comments (9)
@kshvmdn This doesn't look too bad to get in, I haven't looked to much at the parsing logic but should be able to follow the logic for the other key words. Anything other than SHA-1 We'd like to see?
from fsql.
@jonesbrianc26 Sounds good!
Let's do this by introducing a new attribute, hash
. I think the best way to specify which algorithm to use is with an attribute modifier, so perhaps
SELECT SHA1(hash) ...
... WHERE SHA256(hash) = ...
or
SELECT FORMAT(hash, SHA1) ...
... WHERE FORMAT(hash, SHA256) = ...
For the time being, lets stick with SHA-1 and see how that goes (crypto/sha1
will probably be useful for this). We should be able to easily abstract this to support multiple different algorithms in the future.
from fsql.
Turns out this isn't too bad, Though will probably need to rethink the output function a little bit to be smarter with spacing. I'll play around with it a little bit @kshvmdn what do you think?
from fsql.
Awesome!
The original output format was meant to match that of ls -l
, I think we can stick with that?
[mode] [size] [time] [hash] [name]
Also, I think by default, we should show a truncated version of the hash (maybe 7-10 characters, like Git), and we can include a FULL
function to show the full hash (perhaps even a TRUNCATE(, n)
function to specify how many characters to show?). Feel free to leave it at the full hash for now though, we can add these functions later (or go ahead and implement it, up to you!
from fsql.
perhaps just {hashtype}(hash, n)
though, TRUNCATE(,n)
could be useful in general and would be a extremely reusable function so it would make sense to use that under the hood.
from fsql.
You're right, that works better!
If n
isn't provided, let's default it to 7 for the time being, just so the output of all
doesn't overflow.
from fsql.
Also, as far as formatting goes, what would you like to display in place of the hash for directories?
Currently I'm displaying 1 -
for every character in the hash to preserve equal spacing, maybe once I get the PR up we can discuss that a bit more.
from fsql.
Sounds good to me!
from fsql.
Done in #31 – currently only supports SHA-1, feel free to suggest other functions.
from fsql.
Related Issues (20)
- How to show human readable file sizes? HOT 3
- Attribute modifiers HOT 5
- Cannot start commands with `fsql`; have to use $GOPATH/bin/fsql HOT 4
- Add -v Version output HOT 1
- regression test? HOT 3
- Exclude duplicate entries HOT 3
- Allow search in directories starting with - HOT 5
- Go vendoring? HOT 5
- `fsql "SELECT * from . WHERE size > 1gb"` doesn't work HOT 4
- Add support for UPDATE / DELETE operations HOT 2
- Path as attribute HOT 1
- Respecting attribute order HOT 1
- Add support for querying file contents HOT 4
- SELECT query does not print folders from recursive paths. HOT 4
- feature request: plugin API for extending the fsql abilities HOT 3
- Windows support? HOT 2
- Feature request: limit number of results
- Compatibility with future Go versions HOT 1
- Failing darwin builds require a bump of x/sys HOT 2
- missing path as token HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsql.