Comments (9)
Gave it a try here https://github.com/pesterhazy/presumably/blob/master/posts/howto-babashka.md#find-project-folder
from fs.
I mentioned dirname
in the docs of parent
now.
from fs.
OK, PR welcome for dir-name
(as we have file-name
, I think the hyphen would be ok?)
Note that seq
works on the result of fs/path
to split the components, but we could add this as a built-in.
I believe we already have split-list
as split-paths
in fs.
from fs.
Note that
seq
works on the result offs/path
to split the components, but we could add this as a built-in.
Oh, I didn't realize this. Thanks for explaining! And there turns out to be fs/components
, which works like split-path
except for the return type. Sorry I didn't look thoroughly enough before filing an issue. I missed it in API.md
, probably because other file path APIs had primed me to look for different function names. (Maybe it needs a Ctrl+f-friendly note like "Use this to split a path.")
While I can't right now, I will PR dir-name
when I can. (I agree it needs a hyphen.)
from fs.
On second thought: dir-name
is already kind of there as: (-> file fs/parent str)
. parent
is the Java terminology of getting the parent directory from a file and str
is the way of turning a file or path into a string. Not sure if we need to add (defn dir-name [file] (-> file fs/parent str))
?
We could also add a cheat sheet of bash terminology -> fs terminlogy.
cc @pesterhazy
from fs.
except for the return type
You can fix this by doing (map str ...)
.
from fs.
Oops, I missed not one but two of the two functions I wanted. :-) With fs/parent
there is no need for fs/dir-name
. If nobody disagrees, I suggest closing the issue.
We could also add a cheat sheet of bash terminology -> fs terminlogy.
This is a great idea. Thanks for starting one, @pesterhazy.
from fs.
parent is alright, but one has to be careful: (parent "hello.clj")
returns nil
, while dirname "hello.clj"
is '.'
from fs.
We could change that perhaps
from fs.
Related Issues (20)
- add gzip and gunzip functions
- `babashka.fs/glob` does not find directories with `.` in the name HOT 3
- Efficiently read part of a file by seek offsets HOT 3
- UnsupportedOperationException when using `copy-tree` with zip file path as source HOT 5
- Links in API.md don't work HOT 6
- comment inconsistent: fs/parent returns file no matter if it exist or not
- Paths can have FileSystem that have different separators than the OS-specific one HOT 7
- suggestion: fs/find-up HOT 5
- glob: hidden-option based on pattern HOT 2
- fs/match won't find things in root-folder HOT 1
- `with-temp-dir` can raise a `AccessDeniedException` exception HOT 3
- weird behaviour fs/match, fs/glob HOT 8
- copy-tree fail when some non-leaf directories in the tree are not writable HOT 3
- fs/extension handles paths with dot incorrectly HOT 3
- Add common XDG-paths HOT 1
- `babashka.fs/glob` crashes when encountering permission errors HOT 1
- Async-capabilities for fs/glob and fs/match
- Allow for more declarative use of `xdg-*-home` HOT 1
- Consider allowing non-relative paths for fs/which HOT 4
- Add function to see file-owner
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 fs.