[-] [email protected] 1 points 1 hour ago

As of now, I don't really care about portability itself, but I do want to write good software. What you said makes sense to me, so I've decided I will be using the library version, even if that means I have to read up on it's documentation to understand the git api. Thanks!

[-] [email protected] 1 points 1 hour ago

Thank you for your answer. The git crate is still not that easy to understand, but the documentation is there and the interface is alright once you figured out what needs to be done, so I've decided to use it as a library.

7
submitted 4 hours ago* (last edited 1 hour ago) by [email protected] to c/[email protected]

Hello fellow rustaceans! Recently, there was a thread about how we can grow this community (how can I link to posts across servers?), where I already talked briefly about this topic, saying that I did not know if it is worthy of a full post here, as most things seem to be pretty professional looking links to talks and blogs. I've gotten some encouragement to post it, so here we go:

When to use a library instead of a CLI

I'm working on a little project called Autcrate in my free time, which aims to streamline the release and publishing process (what exactly it does isn't really important for this discussion). Autocrate uses git to get the path of the current repo, tags and pushes releases, generates a change log from commits and so on.

Up until a week ago, I was just using the git2 library crate, which offers the functionalities of libgit2 for rust. While good, using this crate is much more complicated than for example just executing git push from my program using std::process::command. I am only using the porcelain functionalities of git (as of now), so all functionality could be achieved by calling the CLI interface.

Question

When is it acceptable to use CLI Commands instead of using libraries provided for that same software?

Is it generally better to use API/ABI from libraries, or is it maybe even better to use the CLI interface, reducing the list of dependencies?

Pro and Con of using Commands instead of libraries

Pro Con
Reduces the dependencies of a crate Adds a dependency that cannot be tracked by cargo
Much easier to program for developers The CLI interface is not versioned and might break in the future
Documentation of the CLI interface is often better than of libraries Bad usage of command cannot be detected at compile time
Cli program might not be available depending on architecture or platform

(this is of course not an exhaustive list. I will edit it if something comes up in the thread.)

Edit

Alright then. Thank you for your answers. While using the git CLI would probably be fine, since it's very stable and available on most systems (especially those for CI/CD), it might change and is at best hacky. I'll be doing the "right" thing and use libgit2 instead of just calling CLI commands.

[-] [email protected] 8 points 1 day ago* (last edited 1 day ago)

Earlier today I thought about making a post asking about a design choice for one of my pet projects, but then i thought: Is that really relevant?

There is a lot of generally informative content here, like the talks or blog entries, so I thought it didn't quite fit. Maybe we should start just sharing thoughts on our pet projects and design choices?

I'm building something that will help me create releases for projects on git servers, publish crates, generate change logs and so on. Up to now I was using git2 as a dependency and pushing, tagging and so on with the API, but then I thought "maybe I can just use the cli interface of git", reducing the dependency chain of my crate and not having to worry about finding the right API calls. I'm not sure what the better choice would be. (I'm only using porcelain commands, for now)

[-] [email protected] 1 points 1 day ago

War is hell

[-] [email protected] 17 points 2 days ago

Aber dann auch veröffentlichen wenn es so weit ist. Vermutlich sind wir relativ alt, weil wir relativ obskur sind?

[-] [email protected] 11 points 2 days ago

Disk encryptions entire point is securing against physical access

[-] [email protected] 105 points 2 days ago

Linux only needs a reboot if you want to update the kernel, normally.

[-] [email protected] 21 points 3 days ago

Ads are just spam that someone pays for

[-] [email protected] 22 points 3 days ago

They make money with people looking for dates, not with people having found them.

[-] [email protected] 24 points 3 days ago* (last edited 3 days ago)

What is the point of a competing standard to html/https? It works pretty well? And CSS and JS are a big part of modern websites (sometimes a bit too big of course, but still).

Https is lightweight too, if you just don't add tons of CSS and JS dependencies?

[-] [email protected] 15 points 3 days ago

Thank you for the good work, you're making the fediverse a better place.

[-] [email protected] 72 points 4 days ago

PLEASE BUY A PART OF MY SINKING SHIP

57
ich🐇iel (feddit.de)
submitted 2 months ago by [email protected] to c/[email protected]

Gemacht mit Prokrastinierung

106
ich🌧️iel (feddit.de)
submitted 6 months ago by [email protected] to c/[email protected]
18
submitted 7 months ago by [email protected] to c/[email protected]

Taucher melden sich fürs Vorstellungsgespräch

65
repost is sus (feddit.de)
submitted 7 months ago by [email protected] to c/[email protected]
2
submitted 8 months ago* (last edited 8 months ago) by [email protected] to c/[email protected]

Chöner

view more: next ›

PlexSheep

joined 8 months ago