Tìm giá trị lớn nhất của hàm số $y=-x+1-\frac{4}{{x+2}}$ trên đoạn$\displaystyle \text{ }\!\![\!\!\text{ }-1;2]$.
A. $\underset{{\text{ }\!\![\!\!\text{ }-1;2]}}{\mathop{{\max }}}\,y=7$
B. $\underset{{\text{ }\!\![\!\!\text{ }-1;2]}}{\mathop{{\max }}}\,y=-1$
C. $\underset{{\text{ }\!\![\!\!\text{ }-1;2]}}{\mathop{{\max }}}\,y=-2$
D. $\underset{{\text{ }\!\![\!\!\text{ }-1;2]}}{\mathop{{\max }}}\,y=2$