Author Topic: Re/Building Tagfiles from Command Line?  (Read 14625 times)

heedless

  • Community Member
  • Posts: 24
  • Hero Points: 1
Re/Building Tagfiles from Command Line?
« on: September 06, 2006, 08:06:30 AM »
Hi.

We would like to create tag files using a script (that also creates clearcase views).
Is it possible to create/build/rebuild tag files from the command line?

Thanks.



heedless

  • Community Member
  • Posts: 24
  • Hero Points: 1
Re: Re/Building Tagfiles from Command Line?
« Reply #1 on: September 07, 2006, 06:44:41 AM »
Anyone?...

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Re/Building Tagfiles from Command Line?
« Reply #2 on: September 07, 2006, 09:59:36 AM »

In the key bindings dialog there is a command projecttbRetagProject that might help (if your tag file is associated with a project) but there's no information in the help about how to use it.  It seems to be associated with the project toolbar but the code actually checks for whether the toolbar is active so it appears it can be called from a command/macro  - except that the name attribute has VSARG2_EXECUTE_FROM_MENU_ONLY  - so it might not work from a macro.  You would also need to open the project first - perhaps using the workspace_open function - the help for this says it displays the Workspace Open dialog box but I suspect if you supply a filename, it won't open the dialog box.

If that doesn't help, you could try experimenting with some of the functions in tagform.e such as _OpenOrCreateTagFile and RetagFilesInView.  If you look in RetagFilesInView you'll see it call tagProgressCallback to show the tagging progress (it shows the percentage of files have been processed and ignores individual file size) - The only time RetagFilesInView uses the tag_filename parameter is to remove a file - but you can see in RetagFilesInTagFile2 it first calls _OpenOrCreateTagFile.  The RetagFilesInTagFile2 function is also called from _workspace_update_files_retag which is the function associated with the projecttbRetagProject I mentioned at the start so I think RetagFilesInTagFile2 is the function you'll need to call.

In case you're wondering, the "view" in RetagFilesInView refers to the "view" you can see described in the help on _create_temp_view.

Graeme

heedless

  • Community Member
  • Posts: 24
  • Hero Points: 1
Re: Re/Building Tagfiles from Command Line?
« Reply #3 on: September 07, 2006, 12:42:49 PM »
Thanks...

But, I meant using a script from OUTSIDE Visual Slickedit.
i.e. from the system shell.




Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Re/Building Tagfiles from Command Line?
« Reply #4 on: September 07, 2006, 03:02:20 PM »

Oh.  So when you said "command line" you meant the shell command line.

Well, you're gonna have to call that function I mentioned one way or another.  One way is to fire up slickedit to execute a macro of your own (e.g. by using -# option when you invoke slickedit - search for invoking in the help) and then close slick (e.g. by calling safe-exit).

Graeme

heedless

  • Community Member
  • Posts: 24
  • Hero Points: 1
Re: Re/Building Tagfiles from Command Line?
« Reply #5 on: September 07, 2006, 03:06:37 PM »
Thanks.

I also just found out about the command "vsmktags" located under "vslick/bin".
Almost what i needed.

(almost, because you can't manually specify directory tree and output tag file, but rather go through a workspace)

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Re/Building Tagfiles from Command Line?
« Reply #6 on: September 08, 2006, 12:48:38 PM »
The forum gets bigger and bigger and already contains a lot of useful stuff.
Try the 'Search' facilitity ;)

http://community.slickedit.com/index.php?topic=253.msg973#msg973

HS2

PS: Was on holiday so I couldn't post the link earlier ...

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6864
  • Hero Points: 528
Re: Re/Building Tagfiles from Command Line?
« Reply #7 on: September 14, 2006, 03:40:06 PM »
To create a tag file from an arbitrary set of files in a shell script, you'll need to use the "make-tags" command.  the "make-tags" command calls the "maketags.e" batch macro.  Edit "maketags.e" to see the options it provides.  Note that make-tags supports a -L <ListFile> option and a -T recursive option (which I couldn't find in the docs:-).
   
  vs +new -p make-tags -t c:\mydir\*.cpp c:\mydir\*.h -o c:\temp\output.vtg -c
  vs +new -p make-tags -L c:\mydir\myfilelist -o c:\temp\output.vtg -c

The -c option displays a progress dialog and provides a cancel button.

IMPORTANT: You MUST use absolute paths in your filespecs because there doesn't seem to be a command line way to turn off auto restore which will change the current directory when the SlickEdit starts.


shague

  • Community Member
  • Posts: 9
  • Hero Points: 0
Re: Re/Building Tagfiles from Command Line?
« Reply #8 on: November 15, 2008, 04:14:53 PM »
Does anyone know if this -p make-tags option still works?

I tried this but it does not produce a tag file. SlickEdit opens and then closes. No tag file produced.

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Re/Building Tagfiles from Command Line?
« Reply #9 on: November 15, 2008, 10:07:07 PM »
Does anyone know if this -p make-tags option still works?

I tried this but it does not produce a tag file. SlickEdit opens and then closes. No tag file produced.

-p is an invocation option  - see invocation options in the help.
make-tags is a batch macro  - see make_tags.e in the slick macros folder.
If I type make_tags on the slick command line I get a dialog window telling me what options I should have supplied to make_tags.

If I run
vs.exe +new -p make_tags
slick opens a new instance, shows me the dialog about what options to supply, then closes.

Some things you could try are
1. do what I did to see that make-tags is actually getting called
2. add a diagnostic line to the make_tags.e definit function
    say(arg(1));
    messageNwait();  // press a key to continue

to see that your command line parameters are getting passed in to maketags. (they are for me).

If I do this at DOS cmd line
Code: [Select]
L:\Apps\vslick-13-0-2\win>vs.exe +new -p make_tags E:\proj\cpp\tests\test1.cpp -
o c:\temp\output.vtg

I get an output.vtg file created in c:\temp.  Not sure where it goes if you don't specify -o.

Graeme


shague

  • Community Member
  • Posts: 9
  • Hero Points: 0
Re: Re/Building Tagfiles from Command Line?
« Reply #10 on: November 17, 2008, 02:49:26 PM »
Graeme,

I believe the Windows 13.0.2.0 version is broken.

What version are you using? I am using 13.0.2.0 under both Windows and Linux.

I receive different results on Windows as compared to Linux.

Under Windows, VS pops up and then exits without producing any results. If I enter "make_tags" from the VS command line, I see a status message at the bottom that says "Module already loaded". And that is it.

Under Linux, everything works fine. Tag file is produced properly. "make_tags" from the VS command line, produces the help menu describing the options.

I also added the test code you mentioned at the beginning. Nothing pops up except the status indicating that the module is already loaded. Under Linux I see the window pop up. Leads me to believe that the make_tags is not really being called and is exiting earlier. So it seems either my Windows VS is broken or somehow configured incorrectly. I pretty much have the standard install, though, so I don't VS is configured incorrectly.

Thanks, Sam

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Re/Building Tagfiles from Command Line?
« Reply #11 on: November 17, 2008, 08:34:42 PM »
Sam

I'm using 13.0.2 on Windows.

make_tags is a batch macro and batch macros aren't supposed to be loaded.
Maybe you could try using the unload module command from the macro menu on make_tags.
Otherwise try the same old...
vs.exe +new -sc c:\temp\virgin-config -p make_tags ...
or backup your config folder and delete vslick.sta (with slick closed).

Graeme


shague

  • Community Member
  • Posts: 9
  • Hero Points: 0
Re: Re/Building Tagfiles from Command Line?
« Reply #12 on: November 18, 2008, 03:16:22 PM »
Graeme,

awesome! The unloading of the make_tags macro got everything working. Wonder why VS was stuck like that, though?

Thank you for the help!

Thanks, Sam