Skip to content

Commit 4e85e99

Browse files
authored
Added fzirob cd misc and cdmisc (#35)
1 parent 502e442 commit 4e85e99

File tree

8 files changed

+32
-0
lines changed

8 files changed

+32
-0
lines changed

bin/rob_folders_source.sh

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ alias ce="fzirob change_environment"
7878
alias cdr="fzirob cd"
7979
alias cdros="fzirob cd ros"
8080
alias cdcol="fzirob cd colcon"
81+
alias cdmisc="fzirob cd misc"
8182
alias cdhome="fzirob cd"
8283
alias makeros="fzirob make ros"
8384
alias makecol="fzirob make colcon"

docs/aliases.rst

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ you get to know them, you'll probably enjoy simply typing ``ce`` instead.
1616
+---------+---------------------------+
1717
| cdcol | fzirob cd colcon |
1818
+---------+---------------------------+
19+
| cdmisc | fzirob cd misc |
20+
+---------+---------------------------+
1921
| cdhome | fzirob cd |
2022
+---------+---------------------------+
2123
| makeros | fzirob make ros |

docs/usage.rst

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ stored inside ``~/checkout``:
206206
fzirob cd # Env root folder e.g. ~/checkout/env_name
207207
fzirob cd ros # Env catkin folder e.g. ~/checkout/env_name/catkin_ws
208208
fzirob cd colcon # Env colcon folder e.g. ~/checkout/env_name/colcon_ws
209+
fzirob cd misc # Env misc_ws folder e.g. ~/checkout/env_name/misc_ws
209210
210211
Again, tab completion will present the possible options for the currently sourced environment.
211212

src/robot_folders/commands/cd.py

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ def get_command(self, ctx, name):
6161
target_dir = dir_helpers.get_catkin_dir()
6262
elif name == "colcon":
6363
target_dir = dir_helpers.get_colcon_dir()
64+
elif name == "misc":
65+
target_dir = dir_helpers.get_misc_dir()
6466
else:
6567
click.echo(
6668
"Did not find a workspace with the key < {} > inside "

src/robot_folders/commands/clean.py

+3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ def get_command(self, ctx, name):
4141
return clean.CatkinCleaner(name=name, add_help_option=False)
4242
elif name == "colcon":
4343
return clean.ColconCleaner(name=name, add_help_option=False)
44+
elif name == "misc":
45+
click.error("Misc workspaces have to cleaned by hand. Doing nothing")
46+
return None
4447
else:
4548
click.echo("Did not find a workspace with the key < {} >.".format(name))
4649
return None

src/robot_folders/commands/make.py

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ def get_command(self, ctx, name):
4343
return build.CatkinBuilder(name=name, add_help_option=False)
4444
elif name == "colcon":
4545
return build.ColconBuilder(name=name, add_help_option=True)
46+
elif name == "misc":
47+
click.error("Misc workspaces have to built by hand. Doing nothing")
48+
return None
4649
else:
4750
click.echo("Did not find a workspace with the key < {} >.".format(name))
4851
return None

src/robot_folders/helpers/directory_helpers.py

+17
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,23 @@ def get_colcon_dir(env_dir=""):
151151
return os.path.join(cur_env_path, "colcon_ws")
152152

153153

154+
def get_misc_dir(env_dir=""):
155+
"""Tries to find the right misc workspace in the Currently \
156+
sourced environment."""
157+
158+
path = ""
159+
cur_env_path = env_dir
160+
if env_dir == "":
161+
cur_env_path = get_active_env_path()
162+
163+
valid_names = ["misc_ws"]
164+
for path_name in valid_names:
165+
path = os.path.join(cur_env_path, path_name)
166+
if os.path.exists(path):
167+
return path
168+
return os.path.join(cur_env_path, "misc_ws")
169+
170+
154171
def yes_no_to_bool(bool_str):
155172
"""
156173
Converts a yes/no string to a bool

src/robot_folders/helpers/workspace_chooser.py

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
get_active_env_path,
3232
get_catkin_dir,
3333
get_colcon_dir,
34+
get_misc_dir,
3435
)
3536

3637

@@ -58,6 +59,8 @@ def list_commands(self, ctx):
5859
cmds.append("colcon")
5960
if os.path.exists(get_catkin_dir()):
6061
cmds.append("ros")
62+
if os.path.exists(get_misc_dir()):
63+
cmds.append("misc")
6164

6265
return cmds
6366

0 commit comments

Comments
 (0)