Skip to content

cmd/edit: check if --force-linebreak coming from CLI or config #791

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

Merged
merged 1 commit into from
Feb 15, 2022

Conversation

bmeneg
Copy link
Collaborator

@bmeneg bmeneg commented Feb 10, 2022

When --force-linebreak is set through the config file the conditional
for opening the editor will always be satisfied no matter what's the
other flag being used together, since it only requires NFlag() == 1 and
linebreak being set.

For instance:

lab.toml:
[mr_edit]
force-linebreak = true

cli:
$ lab mr edit --ready
[EDITOR IS OPENED]

This patch fixes it by checking it linebreak is being actually set
through the CLI, so in case NFlag() == 1 we're sure the user wants to
open the editor considering the "force-linebreak".

Signed-off-by: Bruno Meneguele bmeneg@redhat.com

Related: #790

When --force-linebreak is set through the config file the conditional
for opening the editor will always be satisfied no matter what's the
other flag being used together, since it only requires NFlag() == 1 and
linebreak being set.

For instance:

lab.toml:
    [mr_edit]
    force-linebreak = true

cli:
    $ lab mr edit --ready
    [EDITOR IS OPENED]

This patch fixes it by checking it linebreak is being actually set
through the CLI, so in case NFlag() == 1 we're sure the user wants to
open the editor considering the "force-linebreak".

Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
@codecov
Copy link

codecov bot commented Feb 10, 2022

Codecov Report

Merging #791 (1d65256) into master (8ab707a) will decrease coverage by 0.05%.
The diff coverage is 44.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #791      +/-   ##
==========================================
- Coverage   55.07%   55.02%   -0.06%     
==========================================
  Files          77       77              
  Lines        5641     5656      +15     
==========================================
+ Hits         3107     3112       +5     
- Misses       2255     2263       +8     
- Partials      279      281       +2     
Impacted Files Coverage Δ
cmd/issue_edit.go 72.32% <44.44%> (-2.68%) ⬇️
cmd/mr_edit.go 61.05% <44.44%> (-1.25%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ab707a...1d65256. Read the comment docs.

@bmeneg bmeneg requested a review from zampierilucas February 11, 2022 11:01
@bmeneg bmeneg merged commit 25678df into zaquestion:master Feb 15, 2022
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.

2 participants