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

new "activate" subcommand #585

Open
urbanjost opened this issue Sep 28, 2021 · 1 comment
Open

new "activate" subcommand #585

urbanjost opened this issue Sep 28, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@urbanjost
Copy link
Contributor

urbanjost commented Sep 28, 2021

Description

NAME
   activate(1) - start a subshell with all newly compiled programs in the
                 shell command search path.

SYNOPSIS
   fpm activate [--bindir [DIRECTORY_NAME]] [--list]

DESCRIPTION
 Start a subshell with the designated directory added to the search path.
 Subsequently any application built by fpm(1) will be placed in the directory
 so that it is immediately available for execution. In csh(1) and tcsh(1) a
 rehash(1) command may be required for newly created executables to be located.

 Enter "exit" to return to the environment that existed before the activate
 command was executed.

 While in the subshell the environment variable FPM_BINDIR indicates where
 the latest executables will be stored.

OPTIONS
 --bindir
          by default executables will be placed in the build/latest
          subdirectory under the top directory of the current fpm(1) project.

          If this option is present a full pathname must be specified to an
          existing directory.
 --list   If present, the contents of the current "activate" directory, if any,
          are displayed.
EXAMPLES
   sample commands:

    fpm activate
    fpm activate --bindir $HOME/.local/testbin

Possible Solution

Per some recent discussions on how to improve running programs as you build them,
proposing the above command, which I have working in a basic format in the "shell" branch on a
fork of fpm for anyone that wants to try it, but it currently only is complete enough to try it using the bash shell

https://github.com/urbanjost/fpm

Additional Information

The is a single-file version for the bash shell that can be pulled with curl(1) or wget(1) at https://raw.githubusercontent.com/urbanjost/fpm-tools/main/tools/bootstrap/fpm-activate.F90

Any testing would be appreciated.

@urbanjost urbanjost added the enhancement New feature or request label Sep 28, 2021
@urbanjost
Copy link
Contributor Author

urbanjost commented Sep 28, 2021

suggestions are welcome. Is build/latest a better name than build/bin? Should build/bin be deleted on exit or left so it can be resumed? Should a --list that shows the executables in the "activate" directory show fullpathnames? Would a remove using globbing be useful? In verbose mode should it show the name of the "activate" directory? These are just a few things that come to mind, but I want to at least make sure it works with cmd.exe first.

What shells, especially on MSWindows, need supported?

There is no thumbs-down button on github, so how many down votes or alternative proposals are there? We discussed some others on Fortran Discourse.

"run cmd -- options" is not too bad in the current version when using the default compiler and default options unless you want to run in another directory,
but when you start using options, especially different ones I have found this, even in a prototype state, preferable myself so far.
But by using the recently introduced environment variables or (coming soon?) options in the fpm.toml file that could be kept relatively simple, in which case using -W run_directory would also work for most cases without requiring a subshell and altering the environment. Obviously, I prefer this approach but curious about other voices and/or even how many people might find this useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant