Comments (3)
Yeah, I'm open to this, but first I'd like to ask what the use case of this would be. Is the intent to replicate the command-line app exactly in some other form? If so, then a single par(args []string)
function might actually be best, but I think that's not what library integrations look like most of the time.
I'd imagine if it were to integrate it in some other app, then each high-level function (create, verify, repair, etc.) would be a single function in a package, and all the flags would be replaced with Options
structs.
On the other hand, if the par stuff is meant to be one command in a bigger command-line app (like how create
etc. are all different commands in the single par
app), then I think then the interface for that can be a single function.
So yeah, it all depends on what you ultimately want to do. :)
from gopar.
I forked libpar2cmdline and added a main(args []string)
style function as interface because it was such a pile of spaghetti and, similar to gopar
, there's a bit of initialization going on before the actual c/v/r functions are called which I didn't want to replicate. It works perfectly (of course), and ultimately that's what I care about, but having three functions would be a bit cleaner, where you pass in a filename (/handle?) and a set of parameters (The Options
struct would be a struct of all options with a default set?).
I imagine you'd like to support not just my application, hence the question :)
from gopar.
Yeah, having separate functions for the major operations would be the way I'd do it, I think. For example, Create would look like (CreateResult, err) Create(parFile string, inputFiles []string, options CreateOptions, delegate ...);
, where CreateOptions
would look something like struct { blockSize int; recoveryBlockCount int; ... }
, CreateResult
would maybe have some info about the created files, and delegate
would be called to log events and such.
from gopar.
Related Issues (8)
- Command line options not accepted HOT 3
- Return values. HOT 11
- panic: unexpected ID string HOT 15
- [bug] Creating new parity files: "panic: too many shards" HOT 9
- Subdirectories HOT 10
- Memory usage very high HOT 2
- UTF8 rather than ASCII HOT 4
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 gopar.