* * *

Author Topic: Open project file in OS / shell and GIT Integration  (Read 3409 times)

tudi_x

  • Hero Member
  • *****
  • Posts: 524
Open project file in OS / shell and GIT Integration
« on: August 07, 2018, 04:34:08 pm »
hi,
as part of the commands for committing to the git server the project i need access to command line.
sometimes i do not keep a file manager opened and i need to run the commands for committing to the git server in the project folder.
so i need to open a file manager and navigate to the project folder manually.
is there an option or do you feel a change could be posted to have on right click in Project Inspector the option of opening a file manager and / or command line?
(i have seen this option in Brackets and LiteIDE)
please advise.
thank you
« Last Edit: August 10, 2018, 10:30:21 am by tudi_x »
Lazarus 1.8.4 64b on MX Linux "Horizon"

taazz

  • Hero Member
  • *****
  • Posts: 5337
Re: Open project file in OS / shell
« Reply #1 on: August 07, 2018, 04:51:03 pm »
the same way I open the nautilus in the source folder add a new external tool with a command along the lines of
external application : gnome-terminal
working directory    : $Path($EdFile())

If that does not work then use the Parameters editor and add --working-directory $Path($EdFile()) fine tune as needed.


Oops sorry for windows here are the cmd.exe parameters use /K

https://ss64.com/nt/cmd.html
« Last Edit: August 07, 2018, 04:58:51 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

tudi_x

  • Hero Member
  • *****
  • Posts: 524
Re: Open project file in OS / shell
« Reply #2 on: August 07, 2018, 04:53:53 pm »
sorry, i am not familiar with nautilus. do you have a link or something please?
Lazarus 1.8.4 64b on MX Linux "Horizon"

taazz

  • Hero Member
  • *****
  • Posts: 5337
Re: Open project file in OS / shell
« Reply #3 on: August 07, 2018, 04:57:32 pm »
sorry, i am not familiar with nautilus. do you have a link or something please?
nautilus is the GUI file manager I gave you the terminal application is usually gnome-terminal or xterminal in linux cmd.exe on windows see my updated post above
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

tudi_x

  • Hero Member
  • *****
  • Posts: 524
Re: Open project file in OS / shell
« Reply #4 on: August 07, 2018, 05:38:24 pm »
thank you! sounds complicated only to me most probably ...
i will open a change in the Lazarus tracker to provide something more immediately available to the IDE user.
Lazarus 1.8.4 64b on MX Linux "Horizon"

taazz

  • Hero Member
  • *****
  • Posts: 5337
Re: Open project file in OS / shell
« Reply #5 on: August 07, 2018, 06:10:41 pm »
thank you! sounds complicated only to me most probably ...
i will open a change in the Lazarus tracker to provide something more immediately available to the IDE user.
here a screenshot of the description above. Not that complicated, but if it does not work for you please post OS and what the error message says someone with the same os might be able to help. I'm on windows and I can test and create a command for windows if that helps

PS.
Make sure that the hide main window is not checked my bad I forgot about that.
« Last Edit: August 07, 2018, 06:12:45 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

GetMem

  • Hero Member
  • *****
  • Posts: 3195
Re: Open project file in OS / shell
« Reply #6 on: August 07, 2018, 07:57:42 pm »
@tudi_x
Quote
so i need to open a file manager and navigate to the project folder manually.
I don't know if it helps, but you can right click the status bar(editor window), then click "Open folder...". If the current unit is part of your project it will open the project folder in the file manager.

sash

  • Full Member
  • ***
  • Posts: 104
Re: Open project file in OS / shell
« Reply #7 on: August 07, 2018, 08:46:39 pm »
I have 2 handy shortcuts in external tools
  • Browse project
      my_file_manager
      $ProjPath()
  • Browse binary dir
      my_file_manager
      $Path( $(TargetFile) )
Lazarus 1.8.4 Unversioned directory FPC 3.0.4 x86_64-linux-gtk2

tudi_x

  • Hero Member
  • *****
  • Posts: 524
Re: Open project file in OS / shell
« Reply #8 on: August 09, 2018, 05:30:27 pm »
@GetMem
thank you but on my Linux I did not get the open folder option.

i am attaching two screen captures with this option from Brackets (IDE for JavaScript, HTML, CSS, ...) and LiteIDE (IDE for Go).
i will open a ticket with a change to have the feature in project inspector. i know it is work, i know it is difficult, you guys can cancel or ignore it, but from my perspective i did my best.
Lazarus 1.8.4 64b on MX Linux "Horizon"

taazz

  • Hero Member
  • *****
  • Posts: 5337
Re: Open project file in OS / shell
« Reply #9 on: August 09, 2018, 07:13:01 pm »
@GetMem
thank you but on my Linux I did not get the open folder option.

i am attaching two screen captures with this option from Brackets (IDE for JavaScript, HTML, CSS, ...) and LiteIDE (IDE for Go).
i will open a ticket with a change to have the feature in project inspector. i know it is work, i know it is difficult, you guys can cancel or ignore it, but from my perspective i did my best.
Not enough information what linux? which version of lazarus? as far as I know the menu is not present in lazarus 1.4.4. See attached my suse external tool settings.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

GetMem

  • Hero Member
  • *****
  • Posts: 3195
Re: Open project file in OS / shell
« Reply #10 on: August 09, 2018, 09:35:40 pm »
Quote
@GetMem
thank you but on my Linux I did not get the open folder option.
It was only recently implemented(few months or so), you won't find it in 1.8.4. The good new is it will be available in the next major release.

PS: You should try Lazarus trunk. It's quite trivial to set it up and won't interfere with you current installation
1. open a terminal
1. sudo apt-get install subversion
2. go to a particular folder then: svn co https://svn.freepascal.org/svn/lazarus/trunk lazarus
3. cd to lazarus folder then: make bigide
4. when you wish to update to the recent version: svn update

tudi_x

  • Hero Member
  • *****
  • Posts: 524
Re: Open project file in OS / shell
« Reply #11 on: August 10, 2018, 10:18:25 am »
thank you all for your solutions.

I am adding another two screen captures from Atom and Sublime text where the concept of opening CLI or file manager on right mouse click exists and this functionality is available in the files / folder section. given the fact that Sublime, Atom, Brackets and LiteIDE have exactly the same UX i think we can say that this is how in 2018 IDEs have decided to give access to the user to the folder where his code resides.
i think Lazarus IDE should stick to the same UX implementation as this would provide easy adoption by users coming from other IDEs and also good IDE reviews. Besides LiteIDE the afore mentioned IDEs have larger user base than Lazarus, thus it is that these users would need to adopt Lazarus and not Lazarus users to adopt ex. Atom.

Sticking to this direction I am proposing the below for the Git integration for Lazarus IDE:

1. Prerequisites
verify Git is installed

OS: git --version

if Git is installed enter Git mode for Project Inspector.
in Git mode Project Inspector would initially show on mouse right click a new section Git with initial option:
- initialize

2. Initialization
user can initialize folder in which project file is located as Git repo
on initialize the OS command would be git init.

after git init a hidden folder would be created.

3. Using the Git integration

operations to be supported while in Git mode:
- add file to Git repo aka track file
- remove file from Git repo (but leave file as part of Pascal project)
- change branch (IDE would need to silently reopen project folder)
- commit
- open default terminal at Git repo path
- open default file manager at Git repo path
   
4. UI changes:
- tracked files (files added to the Git repo would have an icon signalizing they were added to the Git repo)
- pop-up menu on mouse right click showing Git actions
- pop up for commit message

Unsupported features for now
a. change of Git email and user name - to be done from CLI
b. create tag
c. navigate through Git changes
« Last Edit: August 10, 2018, 10:29:33 am by tudi_x »
Lazarus 1.8.4 64b on MX Linux "Horizon"

taazz

  • Hero Member
  • *****
  • Posts: 5337
Re: Open project file in OS / shell
« Reply #12 on: August 10, 2018, 11:28:24 am »
thank you all for your solutions.
uninteresting stuff about adaptation and social hierarchies are snipped sorry but I'm only interested in addressing problems not adopting behaviors.
Sticking to this direction I am proposing the below for the Git integration for Lazarus IDE:

1. Prerequisites
verify Git is installed

OS: git --version

if Git is installed enter Git mode for Project Inspector.
in Git mode Project Inspector would initially show on mouse right click a new section Git with initial option:
- initialize

2. Initialization
user can initialize folder in which project file is located as Git repo
on initialize the OS command would be git init.

after git init a hidden folder would be created.

3. Using the Git integration

operations to be supported while in Git mode:
- add file to Git repo aka track file
- remove file from Git repo (but leave file as part of Pascal project)
- change branch (IDE would need to silently reopen project folder)
- commit
- open default terminal at Git repo path
- open default file manager at Git repo path
   
4. UI changes:
- tracked files (files added to the Git repo would have an icon signalizing they were added to the Git repo)
- pop-up menu on mouse right click showing Git actions
- pop up for commit message

Unsupported features for now
a. change of Git email and user name - to be done from CLI
b. create tag
c. navigate through Git changes
Ok that is interesting the git integration is a bit light and needs work those proposals go to my personal list for evaluation. In the mean time I would suggest to post this list as a feature request to the bug tracking site although I do not expect the team to implement them it is a good place to create and keep track of git integration feature list that everybody has access.
Any way have you managed to open the terminal window on the source dir? if yes would you mind posting a screen shot of your tool settings?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

tudi_x

  • Hero Member
  • *****
  • Posts: 524
Re: Open project file in OS / shell and GIT Integration
« Reply #13 on: August 10, 2018, 11:43:32 am »
opened: https://bugs.freepascal.org/view.php?id=34110

i respect and like your sense of humor.

Quote
Any way have you managed to open the terminal window on the source dir? if yes would you mind posting a screen shot of your tool settings?
sorry taazz but i did not understand what i need to do and i looked mostly at installing the IDEs from where i got the screen captures and analyzing the GIT plugin in Brackets.
i will navigate the OS file manager for now.
Lazarus 1.8.4 64b on MX Linux "Horizon"

taazz

  • Hero Member
  • *****
  • Posts: 5337
Re: Open project file in OS / shell and GIT Integration
« Reply #14 on: August 10, 2018, 11:54:50 am »
sorry taazz but i did not understand what i need to do and i looked mostly at installing the IDEs from where i got the screen captures and analyzing the GIT plugin in Brackets.
i will navigate the OS file manager for now.
that's ok I'll fire up my suse VM at home this evening and see if I can make an "open terminal on source dir" external tool if succesfull I'll post a step by step guide.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus