Skip to content

Create subpackage unix #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
breml opened this issue Jul 1, 2019 · 2 comments
Closed

Create subpackage unix #12

breml opened this issue Jul 1, 2019 · 2 comments

Comments

@breml
Copy link

breml commented Jul 1, 2019

Based on the discussion in #7 I would like to suggest a subpackage unix. The suggestion is to have functions in this package, which have the same names as the respective unix commands. This would allow to keep the API of script clean and high level.
At the same time this would provide an easy start for people, how are familiar with the unix commands.
Maybe some of the high level commands in the scriptpackage would even decide to use the unix low level commands for their implementation.

@bitfield
Copy link
Owner

bitfield commented Jul 2, 2019

Very interesting idea! I'll think about this.

@bitfield
Copy link
Owner

bitfield commented Jul 2, 2019

The suggestion is to have functions in this package, which have the same names as the respective unix commands.

I totally understand the reasoning behind this suggestion and it makes sense to me. However, I don't think I want to implement it directly in script, for at least two reasons:

  1. I want script to be usable by people who aren't already familiar with the Unix commands (though obviously the problem domain is much the same, so many of the names will be similar). So I want the column filter to be named Column(), not Cut() for example, because the latter makes very little sense unless you already know about the Unix cut command. If you're fresh out of school and doing your first DevOps job, I want you to be able to grab script and start being productive without having to learn the traditional coreutils commands first.

  2. I don't want there to be two different ways to do the same thing. That's a sure-fire recipe for a confusing and hard-to-maintain API. After all, if you copy the Unix name, you must copy the Unix API, and that's different to the existing script APIs. Translating from one to the other, I think you'll find if you try this to any great extent, is fraught with difficulty.

Now, I'm not saying a unix library like this is a bad idea, or that it shouldn't happen. I'm just saying I won't implement it as part of the script library. Anyone would be welcome (indeed, encouraged) to write their own library which has the Unix command names and APIs, and uses the script library as a backend to implement them (or, indeed, not).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants