robot-folders 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. robot_folders-0.4.1/PKG-INFO +83 -0
  2. robot_folders-0.4.1/README.rst +71 -0
  3. robot_folders-0.4.1/bin/rob_folders-complete.sh +53 -0
  4. robot_folders-0.4.1/bin/rob_folders_get_source_command.py +53 -0
  5. robot_folders-0.4.1/bin/rob_folders_source.sh +199 -0
  6. robot_folders-0.4.1/bin/source_environment.sh +266 -0
  7. robot_folders-0.4.1/setup.cfg +4 -0
  8. robot_folders-0.4.1/setup.py +42 -0
  9. robot_folders-0.4.1/src/robot_folders/__init__.py +0 -0
  10. robot_folders-0.4.1/src/robot_folders/commands/__init__.py +0 -0
  11. robot_folders-0.4.1/src/robot_folders/commands/active_environment.py +46 -0
  12. robot_folders-0.4.1/src/robot_folders/commands/adapt_environment.py +415 -0
  13. robot_folders-0.4.1/src/robot_folders/commands/add_environment.py +416 -0
  14. robot_folders-0.4.1/src/robot_folders/commands/cd.py +93 -0
  15. robot_folders-0.4.1/src/robot_folders/commands/change_environment.py +98 -0
  16. robot_folders-0.4.1/src/robot_folders/commands/clean.py +81 -0
  17. robot_folders-0.4.1/src/robot_folders/commands/delete_environment.py +165 -0
  18. robot_folders-0.4.1/src/robot_folders/commands/get_checkout_base_dir.py +30 -0
  19. robot_folders-0.4.1/src/robot_folders/commands/make.py +86 -0
  20. robot_folders-0.4.1/src/robot_folders/commands/manage_underlays.py +50 -0
  21. robot_folders-0.4.1/src/robot_folders/commands/run.py +91 -0
  22. robot_folders-0.4.1/src/robot_folders/commands/scrape_environment.py +160 -0
  23. robot_folders-0.4.1/src/robot_folders/helpers/ConfigParser.py +74 -0
  24. robot_folders-0.4.1/src/robot_folders/helpers/__init__.py +0 -0
  25. robot_folders-0.4.1/src/robot_folders/helpers/build_helpers.py +313 -0
  26. robot_folders-0.4.1/src/robot_folders/helpers/clean_helpers.py +116 -0
  27. robot_folders-0.4.1/src/robot_folders/helpers/compilation_db_helpers.py +44 -0
  28. robot_folders-0.4.1/src/robot_folders/helpers/config_helpers.py +144 -0
  29. robot_folders-0.4.1/src/robot_folders/helpers/directory_helpers.py +247 -0
  30. robot_folders-0.4.1/src/robot_folders/helpers/environment_helpers.py +362 -0
  31. robot_folders-0.4.1/src/robot_folders/helpers/exceptions.py +35 -0
  32. robot_folders-0.4.1/src/robot_folders/helpers/repository_helpers.py +95 -0
  33. robot_folders-0.4.1/src/robot_folders/helpers/resources/__init__.py +0 -0
  34. robot_folders-0.4.1/src/robot_folders/helpers/resources/userconfig_distribute.yaml +37 -0
  35. robot_folders-0.4.1/src/robot_folders/helpers/ros_version_helpers.py +66 -0
  36. robot_folders-0.4.1/src/robot_folders/helpers/underlays.py +71 -0
  37. robot_folders-0.4.1/src/robot_folders/helpers/which.py +45 -0
  38. robot_folders-0.4.1/src/robot_folders/helpers/workspace_chooser.py +65 -0
  39. robot_folders-0.4.1/src/robot_folders/main.py +100 -0
  40. robot_folders-0.4.1/src/robot_folders.egg-info/PKG-INFO +83 -0
  41. robot_folders-0.4.1/src/robot_folders.egg-info/SOURCES.txt +47 -0
  42. robot_folders-0.4.1/src/robot_folders.egg-info/dependency_links.txt +1 -0
  43. robot_folders-0.4.1/src/robot_folders.egg-info/entry_points.txt +2 -0
  44. robot_folders-0.4.1/src/robot_folders.egg-info/requires.txt +5 -0
  45. robot_folders-0.4.1/src/robot_folders.egg-info/top_level.txt +1 -0
  46. robot_folders-0.4.1/tests/test_add_delete.py +101 -0
  47. robot_folders-0.4.1/tests/test_functionality.py +35 -0
  48. robot_folders-0.4.1/tests/test_get_checkout_base_dir.py +35 -0
  49. robot_folders-0.4.1/tests/test_which.py +42 -0
@@ -0,0 +1,83 @@
1
+ Metadata-Version: 2.1
2
+ Name: robot_folders
3
+ Version: 0.4.1
4
+ Summary: robot_folders is your workspace handling utility around the ROS ecosystem.
5
+ Requires-Python: >=3
6
+ Description-Content-Type: text/x-rst
7
+ Requires-Dist: Click>=8.0
8
+ Requires-Dist: gitpython
9
+ Requires-Dist: inquirer
10
+ Requires-Dist: PyYaml
11
+ Requires-Dist: vcstool
12
+
13
+ Robot Folders
14
+ =============
15
+
16
+ Welcome to ``robot_folders``! ``robot_folders`` is a collection of utility scripts designed to
17
+ streamline and facilitate the management of workspaces used for (ROS) development. It is designed
18
+ to enhance efficiency in handling different environments, consisting of multiple workspaces like a
19
+ ``catkin_workspace`` and ``colcon_workspace`` or a plain CMake workspace.
20
+
21
+ It focuses on optimizing the management of various subworkspaces, contributing
22
+ to a seamless development experience.
23
+
24
+
25
+ Quick start
26
+ ------------
27
+
28
+ It is recommended to install robot_folders using ``pipx`` (You can install ``pipx`` using ``sudo apt
29
+ install pipx``). Please note: With pipx versions < 1.0 you'll have to provide the `--spec` flag
30
+
31
+ .. code:: bash
32
+
33
+ # pipx >= 1.0 (from ubuntu 22.04 on)
34
+ pipx install git+https://github.com/fzi-forschungszentrum-informatik/robot_folders.git
35
+ # pipx < 1.0 (ubuntu 20.04)
36
+ pipx install --spec git+https://github.com/fzi-forschungszentrum-informatik/robot_folders.git robot-folders
37
+
38
+ Upgrade
39
+ -------
40
+
41
+ To upgrade robot_folders using ``pipx`` do
42
+
43
+ .. code:: bash
44
+
45
+ # pipx >= 1.0 (from ubuntu 22.04 on)
46
+ pipx upgrade robot-folders
47
+ # pipx < 1.0 (ubuntu 20.04)
48
+ pipx upgrade --spec git+https://github.com/fzi-forschungszentrum-informatik/robot_folders.git robot-folders
49
+
50
+ Shell setup
51
+ -----------
52
+
53
+ In order to use ``robot_folders`` you'll have to call its source file. How to do this depends on
54
+ the way you installed ``robot_folders`` and on the version of the installation tool.
55
+
56
+ In case you have installed
57
+ ``robot_folders`` using ``pipx`` as described above (and given you use the bash shell), do:
58
+
59
+ .. code:: bash
60
+
61
+ # pipx < 1.3.0 or if ${HOME}/.local/pipx already existed
62
+ echo "source ${HOME}/.local/pipx/venvs/robot-folders/bin/rob_folders_source.sh" >> ~/.bashrc
63
+ # pipx >= 1.3.0
64
+ echo "source ${HOME}/.local/share/pipx/venvs/robot-folders/bin/rob_folders_source.sh" >> ~/.bashrc
65
+
66
+ In case you manually installed ``robot_folders`` using a python virtualenv the path is similarly
67
+
68
+ .. code:: bash
69
+
70
+ echo "source <your-vurtualenv-path>/bin/rob_folders_source.sh" >> ~/.bashrc
71
+
72
+
73
+ Basic usage
74
+ -----------
75
+
76
+ After installation open up a new terminal to use robot_folders. The main
77
+ command for using robot_folders is ``fzirob``. Type
78
+
79
+ .. code:: bash
80
+
81
+ fzirob --help
82
+
83
+ to get an overview over all available commands.
@@ -0,0 +1,71 @@
1
+ Robot Folders
2
+ =============
3
+
4
+ Welcome to ``robot_folders``! ``robot_folders`` is a collection of utility scripts designed to
5
+ streamline and facilitate the management of workspaces used for (ROS) development. It is designed
6
+ to enhance efficiency in handling different environments, consisting of multiple workspaces like a
7
+ ``catkin_workspace`` and ``colcon_workspace`` or a plain CMake workspace.
8
+
9
+ It focuses on optimizing the management of various subworkspaces, contributing
10
+ to a seamless development experience.
11
+
12
+
13
+ Quick start
14
+ ------------
15
+
16
+ It is recommended to install robot_folders using ``pipx`` (You can install ``pipx`` using ``sudo apt
17
+ install pipx``). Please note: With pipx versions < 1.0 you'll have to provide the `--spec` flag
18
+
19
+ .. code:: bash
20
+
21
+ # pipx >= 1.0 (from ubuntu 22.04 on)
22
+ pipx install git+https://github.com/fzi-forschungszentrum-informatik/robot_folders.git
23
+ # pipx < 1.0 (ubuntu 20.04)
24
+ pipx install --spec git+https://github.com/fzi-forschungszentrum-informatik/robot_folders.git robot-folders
25
+
26
+ Upgrade
27
+ -------
28
+
29
+ To upgrade robot_folders using ``pipx`` do
30
+
31
+ .. code:: bash
32
+
33
+ # pipx >= 1.0 (from ubuntu 22.04 on)
34
+ pipx upgrade robot-folders
35
+ # pipx < 1.0 (ubuntu 20.04)
36
+ pipx upgrade --spec git+https://github.com/fzi-forschungszentrum-informatik/robot_folders.git robot-folders
37
+
38
+ Shell setup
39
+ -----------
40
+
41
+ In order to use ``robot_folders`` you'll have to call its source file. How to do this depends on
42
+ the way you installed ``robot_folders`` and on the version of the installation tool.
43
+
44
+ In case you have installed
45
+ ``robot_folders`` using ``pipx`` as described above (and given you use the bash shell), do:
46
+
47
+ .. code:: bash
48
+
49
+ # pipx < 1.3.0 or if ${HOME}/.local/pipx already existed
50
+ echo "source ${HOME}/.local/pipx/venvs/robot-folders/bin/rob_folders_source.sh" >> ~/.bashrc
51
+ # pipx >= 1.3.0
52
+ echo "source ${HOME}/.local/share/pipx/venvs/robot-folders/bin/rob_folders_source.sh" >> ~/.bashrc
53
+
54
+ In case you manually installed ``robot_folders`` using a python virtualenv the path is similarly
55
+
56
+ .. code:: bash
57
+
58
+ echo "source <your-vurtualenv-path>/bin/rob_folders_source.sh" >> ~/.bashrc
59
+
60
+
61
+ Basic usage
62
+ -----------
63
+
64
+ After installation open up a new terminal to use robot_folders. The main
65
+ command for using robot_folders is ``fzirob``. Type
66
+
67
+ .. code:: bash
68
+
69
+ fzirob --help
70
+
71
+ to get an overview over all available commands.
@@ -0,0 +1,53 @@
1
+ ##
2
+ ## Copyright (c) 2024 FZI Forschungszentrum Informatik
3
+ ##
4
+ ## Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ ## of this software and associated documentation files (the "Software"), to deal
6
+ ## in the Software without restriction, including without limitation the rights
7
+ ## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ ## copies of the Software, and to permit persons to whom the Software is
9
+ ## furnished to do so, subject to the following conditions:
10
+ ##
11
+ ## The above copyright notice and this permission notice shall be included in
12
+ ## all copies or substantial portions of the Software.
13
+ ##
14
+ ## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ ## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ ## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17
+ ## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ ## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ ## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ ## THE SOFTWARE.
21
+ ##
22
+
23
+ if [ -n "${ZSH_VERSION+1}" ];
24
+ then
25
+ compdef _rob_folders_completion fzirob
26
+ fi
27
+ if [ -n "${BASH_VERSION+1}" ];
28
+ then
29
+ _fzirob_completion() {
30
+ # replace 'fzirob' with 'rob_folders' for completion
31
+ _rob_folders_completion rob_folders ${@:2}
32
+ return 0
33
+ }
34
+ complete -F _fzirob_completion -o default fzirob
35
+ fi
36
+ #complete -F _rob_folders_completion -o default rob_folders;
37
+
38
+ # ce completion in zsh works through the alias definition. For bash we have to declare it.
39
+ if [ -n "${BASH_VERSION+1}" ];
40
+ then
41
+ _ce_completion() {
42
+ checkout_dir=$(rob_folders get_checkout_base_dir)
43
+ #_envs=$(ls ${checkout_dir})
44
+ _envs=$(ce --help | sed -e '1,/Commands:/d' )
45
+ local cur prev
46
+ COMPREPLY=()
47
+ cur="${COMP_WORDS[COMP_CWORD]}"
48
+ COMPREPLY=( $(compgen -W "${_envs}" -- ${cur}) )
49
+ return 0
50
+ }
51
+
52
+ complete -F _ce_completion -o default ce;
53
+ fi
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env python3
2
+ #
3
+ # Copyright (c) 2024 FZI Forschungszentrum Informatik
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
+ # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+ #
23
+ """Small hacky script to get the correct source_zsh command per click version"""
24
+
25
+ import argparse
26
+ import click
27
+
28
+
29
+ def get_click_version():
30
+ click_version = click.__version__
31
+ click_major_version = click_version.split(".")[0]
32
+ return int(click_major_version)
33
+
34
+
35
+ def print_source_command(shell: str):
36
+ click_version = get_click_version()
37
+ if click_version >= 8:
38
+ print(f"{shell}_source")
39
+ else:
40
+ print(f"source_{shell}")
41
+
42
+
43
+ def main():
44
+ parser = argparse.ArgumentParser()
45
+ parser.add_argument(
46
+ "-s", "--shell", type=str, choices=["bash", "zsh"], default="bash"
47
+ )
48
+ args = parser.parse_args()
49
+ print_source_command(args.shell)
50
+
51
+
52
+ if __name__ == "__main__":
53
+ main()
@@ -0,0 +1,199 @@
1
+ ##
2
+ ## Copyright (c) 2024 FZI Forschungszentrum Informatik
3
+ ##
4
+ ## Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ ## of this software and associated documentation files (the "Software"), to deal
6
+ ## in the Software without restriction, including without limitation the rights
7
+ ## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ ## copies of the Software, and to permit persons to whom the Software is
9
+ ## furnished to do so, subject to the following conditions:
10
+ ##
11
+ ## The above copyright notice and this permission notice shall be included in
12
+ ## all copies or substantial portions of the Software.
13
+ ##
14
+ ## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ ## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ ## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17
+ ## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ ## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ ## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ ## THE SOFTWARE.
21
+ ##
22
+
23
+ # zsh
24
+ if [ -d "$HOME/.local/bin" ] ; then
25
+ PATH="$HOME/.local/bin:$PATH"
26
+ fi
27
+ my_source="source"
28
+ if [ -n "${ZSH_VERSION+1}" ];
29
+ then
30
+ # Get the base directory where the install script is located
31
+ export ROB_FOLDERS_BASE_DIR="$( cd "$( dirname "${(%):-%N}" )/.." && pwd )"
32
+ my_source=$(rob_folders_get_source_command.py -s zsh)
33
+ fi
34
+
35
+ # bash
36
+ if [ -n "${BASH_VERSION+1}" ];
37
+ then
38
+ # Get the base directory where the install script is located
39
+ export ROB_FOLDERS_BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
40
+ my_source=$(rob_folders_get_source_command.py -s bash)
41
+ fi
42
+ eval "$(_ROB_FOLDERS_COMPLETE=${my_source} rob_folders)"
43
+
44
+ # if there is alreay an active environment, refrain from scraping the empty paths
45
+ # (they must already there)
46
+ if [ -z "$ROB_FOLDERS_ACTIVE_ENV" ]; then
47
+ export ROB_FOLDERS_EMPTY_CMAKE_PATH=${CMAKE_PREFIX_PATH}
48
+ export ROB_FOLDERS_EMPTY_PATH=${PATH}
49
+ export ROB_FOLDERS_EMPTY_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
50
+ export ROB_FOLDERS_EMPTY_QML_IMPORT_PATH=${QML_IMPORT_PATH}
51
+ export ROB_FOLDERS_EMPTY_PYTHONPATH=${PYTHONPATH}
52
+
53
+ if [ ! -z "${ROB_FOLDERS_EMPTY_CMAKE_PATH}" ] && [ -z $ROB_FOLDERS_IGNORE_CMAKE_PREFIX_PATH ]
54
+ then
55
+ echo "WARNING! WARNING! WARNING!"
56
+ echo "Your CMAKE_PREFIX_PATH is not empty. This probably means that you explicitly set your
57
+ CMAKE_PREFIX_PATH to include some custom directory. If you want to keep this that way you can
58
+ export the environment variable ROB_FOLDERS_IGNORE_CMAKE_PREFIX_PATH to some arbitrary value to
59
+ suppress this warning. e.g.
60
+
61
+ export ROB_FOLDERS_IGNORE_CMAKE_PREFIX_PATH=\":-)\"
62
+ source /home/mauch/robot_folders/bin/fzirob_source.sh
63
+ "
64
+ echo "By, the way your CMAKE_PREFIX_PATH is: \"${CMAKE_PREFIX_PATH}\""
65
+ echo "WARNING! WARNING! WARNING! END."
66
+ fi
67
+ else
68
+ echo "Robot folder environment active: ($ROB_FOLDERS_ACTIVE_ENV)"
69
+ fi
70
+
71
+
72
+
73
+ # define some legacy aliases from old robot_folders
74
+ alias ce="fzirob change_environment"
75
+ alias cdr="fzirob cd"
76
+ alias cdros="fzirob cd ros"
77
+ alias cdcol="fzirob cd colcon"
78
+ alias cdhome="fzirob cd"
79
+ alias makeros="fzirob make ros"
80
+ alias makecol="fzirob make colcon"
81
+
82
+ add_fzi_project()
83
+ {
84
+ echo "DEPRECATED! DEPRECATED! DEPRECATED! DEPRECATED!"
85
+ echo "The use of this call is deprecated!!!"
86
+ echo "DEPRECATED! DEPRECATED! DEPRECATED! DEPRECATED!"
87
+ echo "Please use the command 'fzirob add_environment' in future"
88
+ echo "DEPRECATED! DEPRECATED! DEPRECATED! DEPRECATED!"
89
+ echo "Executing 'fzirob add_environment' now"
90
+ fzirob add_environment $@
91
+ }
92
+
93
+ # These aliases are created after an environment is changed into.
94
+ # They are environment-specific but are created for all environments.
95
+ # Note: This is not done in the source_environment.sh script as the source
96
+ # script might be overwritten by the user and then suddenly these aliases
97
+ # won't be there anymore. We decided to keep all alias definitions inside
98
+ # this file.
99
+ env_aliases()
100
+ {
101
+ alias kdevsession="kdevelop -s ${ROB_FOLDERS_ACTIVE_ENV}"
102
+ }
103
+
104
+
105
+ check_env()
106
+ {
107
+ # for relevant env_vars
108
+ # for each entry
109
+ # if ROB_FOLDERS_CHECKOUT_DIR in entry and ROB_FOLDERS_ACTIVE_END not in entry
110
+ # cry
111
+ VAR=$(echo "${CMAKE_PREFIX_PATH}" | sed 's/:/ /g')
112
+ checkout_dir=$(rob_folders get_checkout_base_dir)
113
+ for entry in $(echo "${VAR}"); do
114
+ if [[ "${entry}" =~ ${checkout_dir} ]]; then
115
+ if [[ ! "${entry}" =~ ${checkout_dir}/${ROB_FOLDERS_ACTIVE_ENV} ]]; then
116
+ echo "\033[0;33mWARNING: CMAKE_PREFIX_PATH contains a path outside the current env: ${entry}\033[0m"
117
+ echo "You probably built your catkin_ws the first time, when another workspace was sourced. To solve this, go to your catkin_ws, delete build and devel, open a new shell, source your environment, build your catkin_ws."
118
+ fi
119
+ fi
120
+ done
121
+ }
122
+
123
+ reset_environment()
124
+ {
125
+ export CMAKE_PREFIX_PATH=${ROB_FOLDERS_EMPTY_CMAKE_PATH}
126
+ export PATH=${ROB_FOLDERS_EMPTY_PATH}
127
+ export LD_LIBRARY_PATH=${ROB_FOLDERS_EMPTY_LD_LIBRARY_PATH}
128
+ export QML_IMPORT_PATH=${ROB_FOLDERS_EMPTY_QML_IMPORT_PATH}
129
+ export PYTHONPATH=${ROB_FOLDERS_EMPTY_PYTHONPATH}
130
+ }
131
+
132
+
133
+ # Create the fzirob function
134
+ #
135
+ # Since rob_folders is a python program, it cannot execute commands
136
+ # directly on the shell such as 'cd' or setting environment variables.
137
+ # For this reason we created this wrapper function that performs
138
+ # the shell actions.
139
+ fzirob()
140
+ {
141
+ if [ $# -ge 1 ]; then
142
+ # if we want to cd to a directory, we need to capture the output
143
+ if [ $1 = "cd" ]; then
144
+ output=$(rob_folders $@)
145
+ echo "$output"
146
+ cd_target=$(echo "$output" | grep "^cd" | tail -n 1 | sed s/cd\ //)
147
+ if [ ! -z "${cd_target// }" ]; then
148
+ cd ${cd_target}
149
+ fi
150
+ else
151
+ if [ $1 = "add_environment" ] && [ "$2" != "--help" ]; then
152
+ echo "Resetting environment before adding new one."
153
+ reset_environment
154
+ fi
155
+
156
+ echo "rob_folders $@"
157
+
158
+ rob_folders $@
159
+
160
+ if [ $? -eq 0 ]; then
161
+ if [ $1 = "change_environment" ] && [ "$2" != "--help" ]; then
162
+ checkout_dir=$(rob_folders get_checkout_base_dir)
163
+ if [ -f ${checkout_dir}/.cur_env ]; then
164
+ export ROB_FOLDERS_ACTIVE_ENV=$(cat ${checkout_dir}/.cur_env)
165
+ environment_dir="${checkout_dir}/${ROB_FOLDERS_ACTIVE_ENV}"
166
+ if [ -f ${environment_dir}/setup.sh ]; then
167
+ source ${environment_dir}/setup.sh
168
+ elif [ -f ${environment_dir}/setup.zsh ]; then
169
+ source ${environment_dir}/setup.zsh
170
+ elif [ -f ${environment_dir}/setup.bash ]; then
171
+ source ${environment_dir}/setup.bash
172
+ else
173
+ source ${ROB_FOLDERS_BASE_DIR}/bin/source_environment.sh
174
+ fi
175
+ # declare environment-specific aliases
176
+ env_aliases
177
+ #check_env
178
+ else
179
+ echo "Could not change environment"
180
+ fi
181
+ elif [ $1 = "add_environment" ] && [ "$2" != "--help" ]; then
182
+ if [ -z "$ROB_FOLDERS_ACTIVE_ENV" ]; then
183
+ fzirob change_environment
184
+ echo "Sourced new environment"
185
+ else
186
+ echo "Currently, there is a sourced environment ($ROB_FOLDERS_ACTIVE_ENV). Not sourcing new one."
187
+ fi
188
+ fi
189
+ else
190
+ return $?
191
+ fi
192
+ fi
193
+ else
194
+ rob_folders --help
195
+ fi
196
+ }
197
+
198
+ # sourcing alias
199
+ source ${ROB_FOLDERS_BASE_DIR}/bin/rob_folders-complete.sh