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

Config File accounts #52

Closed
phobo3s opened this issue Jul 26, 2024 · 2 comments · Fixed by #54
Closed

Config File accounts #52

phobo3s opened this issue Jul 26, 2024 · 2 comments · Fixed by #54
Assignees
Labels
bug Something isn't working

Comments

@phobo3s
Copy link

phobo3s commented Jul 26, 2024

hello,
i am trying to use new config file support this is my config file

{
    "startDate": "2024",
    "period": "yearly",
    "reports": [
        {
            "name": "balance sheet",
            "cmd": "hledger balancesheet -V -R -4 "
        },
        {
            "name": "Varlıklar",
            "cmd": "hledger balance type:a -V "
        },
        {
            "name": "Yükümlülükler",
            "cmd": "hledger balance type:l "
        },
        {
            "name": "Gelir",
            "cmd": "hledger balance type:r "
        },
        {
            "name": "Gider",
            "cmd": "hledger balance type:x -M -p 2024",
            "locked": true
        },
        {
            "name": "Gelir Tablosu",
            "cmd": "hledger incomestatement "
        },
        {
            "name": "accounts",
            "cmd": "hledger accounts",
            "locked": true
        },
	{
            "name": "printer",
            "cmd": "hledger print "
        }
    ]
}

the accounts tab gives error "hledger: error: unknown flag: --layout (exit status 1)
one more thing;
with this config file the table named "Gider" is shown like this
image

as you can see i give command "cmd": "hledger balance type:x -M -p 2024",
but this result is not monthly

@wllfaria
Copy link

Out of curiosity I've investigated this a little, so @siddhantac, here where all the pagers are built, runCommand is called, and from what I've investigated, just happens that this closure here

func runCommand(cmd string) func(options hledger.Options) string {
	return func(options hledger.Options) string {
		buf, err := accounting.RunCommand(cmd, options)
		if err != nil {
			return err.Error()
		}
		b, err := io.ReadAll(buf)
		if err != nil {
			return err.Error()
		}
		return string(b)
	}
}

always have the options previously defined by other commands, which includes --layout bare which is not supported on the command "accounts".

hopefully this helps you a little

@siddhantac siddhantac added the bug Something isn't working label Jul 27, 2024
@siddhantac siddhantac self-assigned this Jul 27, 2024
@siddhantac
Copy link
Owner

@phobo3s thank you for the bug report!

@wllfaria thank you for the investigation!

I'll fix this soon.

@siddhantac siddhantac linked a pull request Aug 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants