Skip to content

add -c and --clip option to tail - #14

Open
caillouc wants to merge 1 commit into
palortoff:masterfrom
caillouc:master
Open

add -c and --clip option to tail#14
caillouc wants to merge 1 commit into
palortoff:masterfrom
caillouc:master

Conversation

@caillouc

Copy link
Copy Markdown

Add the possibility to copy the first line of the file and display only the tail of the file.
tail would support -c and --clip option

Comment thread src/tail.bash Outdated
@ahippo ahippo mentioned this pull request Apr 26, 2022

@ahippo ahippo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, shellcheck also complains quite a bit:
(which can be fixed by basically wrapping up the whole thing into a function like cmd_tail()

$ make lint
shellcheck -s bash src/tail.bash

In src/tail.bash line 3:
local opts clip=0
^---^ SC2168: 'local' is only valid in functions.


In src/tail.bash line 5:
local err=$?
^---^ SC2168: 'local' is only valid in functions.


In src/tail.bash line 14:
local pass
^---^ SC2168: 'local' is only valid in functions.


In src/tail.bash line 15:
local path="$1"
^---^ SC2168: 'local' is only valid in functions.


In src/tail.bash line 16:
local passfile="$PREFIX/$path.gpg"
^---^ SC2168: 'local' is only valid in functions.


In src/tail.bash line 23:
                local cpy="$(echo "$pass" | $BASE64 -d | head -n 1)"
                ^---^ SC2168: 'local' is only valid in functions.
                      ^-^ SC2155: Declare and assign separately to avoid masking return values.

For more information:
  https://www.shellcheck.net/wiki/SC2168 -- 'local' is only valid in functions.
  https://www.shellcheck.net/wiki/SC2155 -- Declare and assign separately to ...
make: *** [Makefile:37: lint] Error 1

@palortoff

palortoff commented Apr 26, 2022

Copy link
Copy Markdown
Owner

This looks great. Thanks

Could you please make a note in the readme to explain the -c option?

Also please add this to the completion.

COMPREPLY+=($(compgen -W "-c --clip" -- ${cur}))

Finally please rebase on master and squash the commit so that the PR only consists of one commit.

Also thanks to @ahippo for the review!

Comment thread src/tail.bash
@ahippo

ahippo commented Apr 28, 2022

Copy link
Copy Markdown

Also thanks to @ahippo for the review!

Sure, you're welcome!

@ahippo

ahippo commented May 2, 2022

Copy link
Copy Markdown

Looks good to me!

@caillouc

Copy link
Copy Markdown
Author

Don't hesitate to tell me if you need me to add anything

@johnrichardrinehart

Copy link
Copy Markdown

@palortoff Good to merge?

@ahippo

ahippo commented Aug 12, 2022

Copy link
Copy Markdown

@palortoff , any help needed in merging the PR?

@caillouc

Copy link
Copy Markdown
Author

@palortoff I think the pull request is ready for a merge now

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

Successfully merging this pull request may close these issues.

4 participants