Giter Club home page Giter Club logo

formattag's Introduction

                                               .------.------.    
+-------------+                     ___        |      |    ( |    
|             |                     \ /]       |      |      |    
|             |        _           _(_)        |      |      |    
|             |     ___))         [  | \___    |      |      |    
|             |     ) //o          | |     \   |      |      |    
|             |  _ (_    >         | |      ]  |      |      |    
|          __ | (O)  \__<          | | ____/   '------'------'    
|         /  o| [/] /   \)        [__|/_                          
|             | [\]|  ( \         __/___\_____                    
|             | [/]|   \ \__  ___|            |                   
|             | [\]|    \___E/%%/|____________|_____              
|             | [/]|=====__   (_____________________)           .
|             | [\] \_____ \    |                  |           ":"
|             | [/========\ |   |                  |         ___:____     |"\/"|
|             | [\]     []| |   |                  |       ,'        `.    \  /
|             | [/]     []| |_  |                  |       |  O        \___/  |
|             | [\]     []|___) |                  |      ~^~^~^~^~^~^~^~^~^~^~^~^~
======================================================================================

formattag's People

Contributors

lewinz avatar momaek avatar seriallink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

formattag's Issues

add support for CJK?

in CJK, a char occupies two chars width.

So I want it formatted like this:

Before

type Test struct {
	NormalChars string `json:"normalChars" t:"abc" othertag:"123"`
	CjkChars    string `json:"cjkChars"    t:"中の한" othertag:"456"`
}

image

After

type Test struct {
	NormalChars string `json:"normalChars" t:"abc"    othertag:"123"`
	CjkChars    string `json:"cjkChars"    t:"中の한" othertag:"456"`
}

image

but beacuse of fonts, it may not be strictly aligned visually.

Oops the formattag remove tag

The original content:

package models

import (
	"gorm.io/gorm"
)

// Location 位置,分部,办公室
type Location struct {
	ID             uint    `json:"id,omitempty"    gorm:"primaryKey"`                                           // 主建
	OrganizationID uint    `json:"organization_id" gorm:"uniqueIndex:uix_org_name"`                             // 组织 ID
	Name           string  `json:"name"            gorm:"size:255;uniqueIndex:uix_org_name" binding:"required"` // 名称
	Description    string  `json:"description"     gorm:"type:text"`                                            // 描述
	Avatar         string  `json:"avatar"`                                                                      // LOGO
	Address        string  `json:"address"`                                                                     // 地址
	ZipCode        string  `json:"zip_code"`                                                                    // 邮政编码
	Phone          string  `json:"phone"`                                                                       // 电话号码
	Fax            string  `json:"fax"`                                                                         // 传真
	Position       float64 `json:"position"`                                                                    // 排序位置

	CreatedAt int64 `json:"created_at,omitempty"` // 创建时间
	UpdatedAt int64 `json:"updated_at,omitempty"` // 更新时间

	CountMembers int `json:"count_members" sql:"-"`
}

// AfterCreate gorm after create Callback
func (location *Location) AfterCreate(tx *gorm.DB) (err error) {
	err = tx.UpdateColumn("position", location.ID).Error
	return
}

After run formattag:

package models

import (
	"gorm.io/gorm"
)

// Location 位置,分部,办公室
type Location struct {
	ID             uint    `json:"id,omitempty"    gorm:"primaryKey"`                                           // 主建
	OrganizationID uint    `json:"organization_id" gorm:"uniqueIndex:uix_org_name"`                             // 组织 ID
	Name           string  `json:"name"            gorm:"size:255;uniqueIndex:uix_org_name" binding:"required"` // 名称
	Description    string  `json:"description"     gorm:"type:text"`                                            // 描述
	Avatar         string  `json:"avatar"`                                                                      // LOGO
	Address        string  `json:"address"`                                                                     // 地址
	ZipCode        string  `json:"zip_code"`                                                                    // 邮政编码
	Phone          string  `json:"phone"`                                                                       // 电话号码
	Fax            string  `json:"fax"`                                                                         // 传真
	Position       float64 `json:"position"`                                                                    // 排序位置

	CreatedAt int64 `json:"created_at,omitempty"` // 创建时间
	UpdatedAt int64 // 更新时间

	CountMembers int `json:"count_members" sql:"-"`
}

// AfterCreate gorm after create Callback
func (location *Location) AfterCreate(tx *gorm.DB) (err error) {
	err = tx.UpdateColumn("position", location.ID).Error
	return
}

goland watcher formattag background process running forever

Add custom watcher to goland according to README file:
image

But after save file execution is freezes and not complete:
image
process in table:
image

From command line works fine (good stuff!, thx).

If try a shell wrap, works fine too:

cat run.sh 
#!/bin/bash
/opt/formattag/formattag -file "$1" &

image

Any tips? Thx.

Support for stdin input?

Hello. Is it possible to include support for stdin input, instead of specifying a filepath? So that cat file.go | formattag --stdin (or something) would format tags and output results it to stdout.

Some context: I've recently moved from VSCode to Helix. It's still in the development and there's no support for something like ${FILE} variable, like in vscode, but it does support unix | pipe as a first class operator/function, so that piping into other commands (like sort) is very easy.

I probably can do a PR, but it could me take a while to get familiar with the codebase.

Add support for emacs

I'm not sure if there's a package for Emacs that's does something similar to this.
UPDATE: I have not found a package that has can do this so i'll create my own and share it here.

Formattag modifying `env-delim` struct value

Formattag is deleting commas out from struct tags. Tried it with a few different punctuation marks and it only seems to delete lone commas.

Before formattag:

type options struct {
	s []string `env-delim:","`
}

After formattag:

type options struct {
	s []string `env-delim:""`
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.