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

git version relies on local binary #43

Open
ccoVeille opened this issue May 22, 2024 · 11 comments
Open

git version relies on local binary #43

ccoVeille opened this issue May 22, 2024 · 11 comments

Comments

@ccoVeille
Copy link
Contributor

cmd := exec.Command("git", "describe", "--tags", "--always")

I would recommend using
https://github.com/go-git/go-git

@theredditbandit
Copy link
Owner

theredditbandit commented May 22, 2024

This approach to get the version is actually flawed 😅.

I realized this as soon I merged #41 into master but the issue with this is , the git approach works when pman is run inside the pman repo and not outside it.

Also it relies on the end user having a copy of the pman source code that's up to date with remote.

I looked into an alternate approach that uses build flags while building the pman binary like so

#!/bin/bash

# Get the current commit tag or hash
version=$(git describe --tags --always)

# Build and install the application with the version information
go install -ldflags "-X main.version=${version}"

but have not gone ahead with that for now.

I have pushed a temporary fix in #42 for now that removes this approach and uses hard coded versioning.

@ccoVeille
Copy link
Contributor Author

Oh I thought your code was about using git in each project to get metadata.

@ccoVeille
Copy link
Contributor Author

About getting a nice version into cobra, you could use this

https://github.com/mszostok/version

@theredditbandit
Copy link
Owner

Oh I thought your code was about using git in each project to get metadata.

It was not , but it could be . . . maybe ? 😂

did you have any ideas about something that you would like to see in pman.

I am planning on adding a github style heatmap and a per-project todo list of sorts sometime later.

@ccoVeille
Copy link
Contributor Author

ccoVeille commented May 22, 2024

Oh I thought your code was about using git in each project to get metadata.

It was not , but it could be . . . maybe ? 😂

did you have any ideas about something that you would like to see in pman.

I am planning on adding a github style heatmap and a per-project todo list of sorts sometime later.

It's what I thought about when I started using pman, I expected to see the number of starsh, uncommitted files, local commit, local branches. Currently it's a bit manual.

I also thought about features such as fork-cleaner, but in a local way. Like OK, I have nothing left with this project (and I have ways to know it's true) so I can safely delete a project.

https://github.com/caarlos0/fork-cleaner

I'm testing tons of projects locally.

Interesting things could also be about checking metadata such a project creation, last modified, last action in git (because it could differ if you switched branch), to sort project by activity

@theredditbandit
Copy link
Owner

About getting a nice version into cobra, you could use this

https://github.com/mszostok/version

I tried this , and it's really convenient too but it increased the binary size from 15M to 21M.

I feel just to print the version info this is too bulky.

@theredditbandit
Copy link
Owner

Oh I thought your code was about using git in each project to get metadata.

It was not , but it could be . . . maybe ? 😂
did you have any ideas about something that you would like to see in pman.
I am planning on adding a github style heatmap and a per-project todo list of sorts sometime later.

It's what I thought about when I started using pman, I expected to see the number of starsh, uncommitted files, local commit, local branches. Currently it's a bit manual.

I also thought about features such as fork-cleaner, but in a local way. Like OK, I have nothing left with this project (and I have ways to know it's true) so I can safely delete a project.

https://github.com/caarlos0/fork-cleaner

I'm testing tons of projects locally.

Interesting things could also be about checking metadata such a project creation, last modified, last action in git (because it could differ if you switched branch), to sort project by activity

Thanks for the ideas! , I had not considered this but I'll be working to add more git based features and more stats and info about individual projects in the future.

regarding the local fork-cleaner feature. how would that work. I would prompt the user to delete certain project dirs if the repo hasn't seen any activity in x days ?

@ccoVeille
Copy link
Contributor Author

About getting a nice version into cobra, you could use this

https://github.com/mszostok/version

I tried this , and it's really convenient too but it increased the binary size from 15M to 21M.

I feel just to print the version info this is too bulky.

Indeed, I didn't expect such a consequence in term of size.

BTW, I would like to recommend this tool if you are interested in following your binary size

https://github.com/Zxilly/go-size-analyzer ( 👋 @Zxilly )

@ccoVeille
Copy link
Contributor Author

regarding the local fork-cleaner feature. how would that work. I would prompt the user to delete certain project dirs if the repo hasn't seen any activity in x days ?

I'm unsure. I would say it could be interesting to say something like no pending changes, no stash, no local branch.

I would say it's more something about the context.

Anyway, I'm also a bit afraid this kind of features would bring the tool in reinventing the wheel while other project exists to manage multi repositories. I don't have names here, I have never find them easy and safe to use.

For advanced usages on a project, I would use git-machete.

@theredditbandit
Copy link
Owner

Anyway, I'm also a bit afraid this kind of features would bring the tool in reinventing the wheel while other project exists to manage multi repositories. I don't have names here, I have never find them easy and safe to use.

For advanced usages on a project, I would use git-machete.

Yeah , I don't want to implement a full-fledged git client, we already have tools like git-machete and lazygit for that.

I think I'll stick to showing basic stats first like

  • commit heatmap
  • stars on a project
  • current branch
  • time since last commit
  • staged files , if any

@ccoVeille
Copy link
Contributor Author

I agree with you. It's better to let the tool grow at your pace, and consider adding features as the people request for them via feature request

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

No branches or pull requests

2 participants