peek(1) #93
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
joke
question
wontfix
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: bonsai/coreutils#93
Loading…
Reference in New Issue
No description provided.
Delete Branch "peek"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
peek(1) is a utility that reads standard input and writes to given outputs without echoing to the terminal. It has a number of features that make safer usage convenient and both the code and the man page are very cleanly written. This tool's utility is obvious in the examples; while shell scripts shouldn't accept secrets, if they were to do so this is a thoughtfully designed utility for that task.
This is imported from my source tree with slight tweaks for this repository. @silt helped review this code when it was first written (four months ago).
mm(1) isn't suited for this task because it doesn't prevent terminal echoing. The shell built-in
read
doesn't either. The featureset of this utility wouldn't make sense for any other one, either (-1
could be| head -n 1
,-e
could be| tee /dev/stderr
,-n
could be| tr -d \\n
,-o
is a default everywhere,-p
is a pipe, and-t
doesn't make sense elsewhere).@ -0,0 +19,4 @@
.SH DESCRIPTION
Peek reads input from standard input with terminal echo disabled, which may be
Read input from the standard input with terminal echo disabled.
Should this be placed in a RATIONALE section?
@ -0,0 +45,4 @@
.B -o
.RS
Configures peek to output to standard output.
“[...] the standard output”
@ -0,0 +48,4 @@
Configures peek to output to standard output.
.RE
.B -p
What is the benefit to this over using a shell pipe?
@ -0,0 +94,4 @@
.R $ env -i PATH="$PATH" peek -1tp htpasswd -nBi _ | cut -d : -f 2
.RE
This is a POSIX sh(1) command line that lets a user blindly write into a text
Either:
or:
Could this functionality be attained using a combination of existing or hypothetical utilities and shell features? We should consider whether this utility should be necessary for its use case.
Yes, actually. After rethinking it I rewrote the utility to be as simple as possible (and have
-t
be the default as it should have been). The man page has been updated to match, including incorporating all of your comments which I found to be useful.peek(1)to WIP: peek(1)WIP: peek(1)to peek(1)Step 1:
From your project repository, check out a new branch and test the changes.Step 2:
Merge the changes and update on Forgejo.