Skip to content
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

Feature request > Configure input command from file #74

Closed
6 tasks done
adriens opened this issue Mar 22, 2022 · 10 comments
Closed
6 tasks done

Feature request > Configure input command from file #74

adriens opened this issue Mar 22, 2022 · 10 comments
Labels
BUILD enhancement New feature or request

Comments

@adriens
Copy link
Member

adriens commented Mar 22, 2022

📜 Read (and accept) this before

  • I am respectful : this is free software and efforts are made on free time, with 💙
  • I have looked at the current project roadmap
  • I have already looked in current and past issues so I'm sure others did not already push a simlar issue
  • I make one single issue per feature request so the team can work efficienlty on it
  • I am aware of Unix philosophy : Make each program do one thing well
  • When (and if) your feature is implemented, be thankful and help promote the project by sharing the issue on social networks (twitter, linkedIn, dev.to...) and dropping the url on te issue

❔ Context

Detail the current situation/difficultes or problem you are facing and how you think yamlfixer could help :

👉 Actually we neeed to call a command line to run a yamlfixer command.

... but in some cases, it is possible that we could have to always run the same command with the same parameters from the same directory.

💡 Proposed solution

Detail here what you would like yamlfixer to do to help on the problematic.

In that case, the command line can be historized/versioned for example in CI scenarios.

it could looke like that :

yamlfixer --conf PATH_TO_YMLFXR_CONF

All parameters could be put in the conf file.. probably as simple yml file so it could be linted itsefl by yamlfixer and also deal with potential hierarchical parameters.

By default .yamllint could be the conf file (thanks for pointing this @tamere-allo-peter 👍 )

📑 Linked resources

@adriens adriens added the enhancement New feature or request label Mar 22, 2022
@adriens
Copy link
Member Author

adriens commented Mar 22, 2022

Feature being actually discussed with @tamere-allo-peter and @mbarre

@tamere-allo-peter
Copy link
Member

@adriens no .yamllint can't be the conf file, I meant .yamlfixer

Anyway currently yamlfixer doesn't have many configuration options, so instead I propose allowing it to read all or parts of the command line arguments from a file, using the well-known @argsfilename syntax :

$ cat arguments
--summary
xx/fakeansiblevault.yml
xx/bad.yml
xx/good.yml
xx/withtabs.yml

$ yamlfixer --jsonsummary @arguments
usage: yamlfixer [-h] [-v] [-b] [-B BACKUPSUFFIX] [-d] [-l] [-j | -p | -s] [-t TABSIZE] [file [file ...]]
yamlfixer: error: argument -s/--summary: not allowed with argument -j/--jsonsummary

$ yamlfixer @arguments <examples/bad.yml
---
name: Build HelloYaml

# yamllint disable-line rule:truthy
on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 11
        uses: actions/setup-java@v2
        with:
          java-version: 11
          distribution: 'adopt'
          cache: 'maven'

      - name: Build with Maven
        run: mvn package
Files to fix: 5
1 files successfully passed yamllint strict mode
3 files were modified
1 files were skipped
0 files were not writeable
0 files with unknown status
 SKIPPED /home/jerome/yamlfixer/xx/fakeansiblevault.yml
MODIFIED /home/jerome/yamlfixer/xx/bad.yml (handled 4/4)
  PASSED /home/jerome/yamlfixer/xx/good.yml
MODIFIED /home/jerome/yamlfixer/xx/withtabs.yml (handled 1/1)
MODIFIED <stdin> (handled 4/4)

@tamere-allo-peter
Copy link
Member

@adriens not sure if a new release is needed for this, as I thought it was either already working or a very quick fix, and in reality it was a one-liner...

@adriens
Copy link
Member Author

adriens commented Mar 22, 2022

So it was working with this approach.

not sure if a new release is needed for this, as I thought it was either already working or a very quick fix, and in reality it was a one-liner...

If it's the case, yep, no need for a new reelase 👍

@adriens
Copy link
Member Author

adriens commented Mar 22, 2022

... maybe a dedicated entry in the README could help ❔

@tamere-allo-peter
Copy link
Member

Just released with this dedicated entry.

@adriens
Copy link
Member Author

adriens commented Mar 22, 2022

Let me have a 👀

@adriens
Copy link
Member Author

adriens commented Mar 22, 2022

Could you be more specific eg. with :

  • a dedicated subsection
  • a pseudo code example

As for now it's not that easy for me to understad how to use this feature :

image

Next, I'll create a dedicated asciinema tuto cf #62

@adriens adriens reopened this Mar 22, 2022
@adriens
Copy link
Member Author

adriens commented Mar 22, 2022

🙏

@adriens
Copy link
Member Author

adriens commented Apr 7, 2022

🚀

@adriens adriens added the BUILD label Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUILD enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants