diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ea428d6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,65 @@ +name: Create Release + +on: + push: + tags: + - 'v*' + +jobs: + build: + name: Build and Release + runs-on: ubuntu-latest + outputs: + app_name: ${{ steps.extract_repo_name.outputs.app_name }} + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Extract repository name + id: extract_repo_name + run: echo "::set-output name=app_name::$(echo ${GITHUB_REPOSITORY##*/})" + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.22' # Adjust as needed + + - name: Build for Linux + run: | + GOOS=linux GOARCH=amd64 go build -o ${{ steps.extract_repo_name.outputs.app_name }}-linux-amd64 + tar czvf ${{ steps.extract_repo_name.outputs.app_name }}-linux-amd64.tar.gz ${{ steps.extract_repo_name.outputs.app_name }}-linux-amd64 + + - name: Build for Windows + run: | + GOOS=windows GOARCH=amd64 go build -o ${{ steps.extract_repo_name.outputs.app_name }}-windows-amd64.exe + tar czvf ${{ steps.extract_repo_name.outputs.app_name }}-windows-amd64.tar.gz ${{ steps.extract_repo_name.outputs.app_name }}-windows-amd64.exe + + - name: Build for macOS + run: | + GOOS=darwin GOARCH=amd64 go build -o ${{ steps.extract_repo_name.outputs.app_name }}-darwin-amd64 + tar czvf ${{ steps.extract_repo_name.outputs.app_name }}-darwin-amd64.tar.gz ${{ steps.extract_repo_name.outputs.app_name }}-darwin-amd64 + + - name: Generate Checksums + run: sha256sum *.tar.gz > SHA256-checksums.txt + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload Release Artifacts + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ steps.extract_repo_name.outputs.app_name }}-linux-amd64.tar.gz + asset_name: ${{ steps.extract_repo_name.outputs.app_name }}-linux-amd64.tar.gz + asset_content_type: application/gzip + # Repeat for each artifact \ No newline at end of file diff --git a/README.md b/README.md index 7e3e42e..9fe60ff 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,15 @@ sudo make uninstall ## How-to-Use Help: ```bash -csv-viewer --help --h, --help --v, --view (column, table, json) --c, --columns +Display CSV content in various formats: column, table, json. + +Usage: + csv-viewer [filePath] [flags] + +Flags: + -c, --columns string Select columns to display (e.g., --columns="1,3") + -h, --help help for csv-viewer + -v, --view string View mode: column, table, json (default "column") ``` ### Column view @@ -45,7 +50,13 @@ csv-viewer --view table ./test/test.csv Result: ``` - ++-----+--------------------------------+-----------+ +| AAA | Description with a comma, and | More text | +| | a quote "like this" | | ++-----+--------------------------------+-----------+ +| BBB | Another description, with a | More text | +| | newline like this | | ++-----+--------------------------------+-----------+ ``` ### JSON view